From nobody Mon Apr 29 08:50:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+46194+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+46194+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1566441850; cv=none; d=zoho.com; s=zohoarc; b=c6V7Mwtcsg3aQAo12goFmgMBUa51fzBi9LTO9WdpafiDNaIH6lb4dkuftNi5yN1287J8v0E/Nj490NnsIqX0gZd/xLBZ6BDFREZtiBhcV8aBMy+pnljy+UcA+a63ShYI3SN0qnYUrT5E6bPJutQc6C170s3wFpLN0+4Y12x+XlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566441850; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=3RPHR8LMGVNmOxmQLGh7LHSjEF/Pr9JfmNAVqoPCpGU=; b=h27D30TFYq4irNHR7i/4O92BC4y4kTa61QV4692Rmty8o5Lsu6wfC2NyoUvkrrxXuuFBvCTb007TO/4ND9PLck9nEwFJWm04cCct5AxJ82/F2KUY+QZM59mnAOHjWgySi782X8LG0t/Xc1qGudJMUZYhaYT8rmMn0CEJwkPVHN8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+46194+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1566441850489149.04054326191317; Wed, 21 Aug 2019 19:44:10 -0700 (PDT) Return-Path: X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Wed, 21 Aug 2019 19:44:09 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Aug 2019 19:44:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,415,1559545200"; d="scan'208";a="203234230" X-Received: from jshi19-mobl.ccr.corp.intel.com ([10.249.173.65]) by fmsmga004.fm.intel.com with ESMTP; 21 Aug 2019 19:44:07 -0700 From: "Steven Shi" To: devel@edk2.groups.io Cc: liming.gao@intel.com, bob.c.feng@intel.com, "Shi, Steven" Subject: [edk2-devel] [PATCH] [edk2-stable201908] BaseTools: Support long file path in windows for misc functions Date: Thu, 22 Aug 2019 10:43:59 +0800 Message-Id: <20190822024359.13968-1-steven.shi@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,steven.shi@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1566441850; bh=/cvrX9Xx+cWkcuuqLE8shUfbJQtR6o2DSlG1SP+fFg8=; h=Cc:Date:From:Reply-To:Subject:To; b=DmInML5DecmRpcsefvuP60aeNfJpfzkPciMRQiW6IPi8AmEcd0sIAVUVlx9JWXq0cNB QPVjTHm86I4vKC5HcdH9xULyqpJYYhJtS0+CFC7vmnmjT53+31WZW7WviTz0dM6lFIWf5 Sbjts0dcKF/jGU4s1593ZJ82KKS9qCA2G9c= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Shi, Steven" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2103 Current CopyFileOnChange() and SaveFileOnChange() in BaseTools\Source\Python\Common\Misc.py don't use the dedicated long file path API to handle the file path strings and cannot support the long file path copy and save in windows. This patch enhances them to support the long file path copy and save correctly. Cc: Liming Gao Cc: Bob Feng Signed-off-by: Steven Shi Reviewed-by: Bob Feng --- BaseTools/Source/Python/Common/Misc.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 4799635cc4..15ae6a9e40 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -34,6 +34,8 @@ from Common.BuildToolError import * from CommonDataClass.DataClass import * from Common.Parsing import GetSplitValueList from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.LongFilePathSupport import CopyLongFilePath as CopyLong +from Common.LongFilePathSupport import LongFilePath as LongFilePath from Common.MultipleWorkspace import MultipleWorkspace as mws from CommonDataClass.Exceptions import BadExpression from Common.caching import cached_property @@ -450,6 +452,9 @@ def RemoveDirectory(Directory, Recursively=3DFalse): # def SaveFileOnChange(File, Content, IsBinaryFile=3DTrue, FileLock=3DNone): =20 + # Convert to long file path format + File =3D LongFilePath(File) + if os.path.exists(File): if IsBinaryFile: try: @@ -530,6 +535,11 @@ def SaveFileOnChange(File, Content, IsBinaryFile=3DTru= e, FileLock=3DNone): # @retval False No copy really happen # def CopyFileOnChange(SrcFile, Dst, FileLock=3DNone): + + # Convert to long file path format + SrcFile =3D LongFilePath(SrcFile) + Dst =3D LongFilePath(Dst) + if not os.path.exists(SrcFile): return False =20 @@ -561,7 +571,7 @@ def CopyFileOnChange(SrcFile, Dst, FileLock=3DNone): # copy the src to a temp file in the dst same folder firstly, then # replace or rename the temp file to the destination file. with tempfile.NamedTemporaryFile(dir=3DDirName, delete=3DFalse) as tf: - shutil.copy(SrcFile, tf.name) + CopyLong(SrcFile, tf.name) tempname =3D tf.name try: if hasattr(os, 'replace'): --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#46194): https://edk2.groups.io/g/devel/message/46194 Mute This Topic: https://groups.io/mt/32986119/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-