From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 80F6C210C2D65 for ; Mon, 2 Jul 2018 22:04:23 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2018 22:04:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,302,1526367600"; d="scan'208";a="242537139" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 02 Jul 2018 22:04:05 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 22:04:05 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 2 Jul 2018 22:04:04 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.87]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.51]) with mapi id 14.03.0319.002; Tue, 3 Jul 2018 13:04:03 +0800 From: "Gao, Liming" To: Chris Co , "edk2-devel@lists.01.org" Thread-Topic: [PATCH v2 1/1] BaseTools/Trim: Normalize filepaths to fix comparisons on Windows Thread-Index: AQHUDxai0I0MawmwQk6g2fYeXY7H6KR8+DuQ Date: Tue, 3 Jul 2018 05:04:01 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E2A12A7@SHSMSX104.ccr.corp.intel.com> References: <20180628193107.48332-1-christopher.co@microsoft.com> <20180628193107.48332-2-christopher.co@microsoft.com> In-Reply-To: <20180628193107.48332-2-christopher.co@microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v2 1/1] BaseTools/Trim: Normalize filepaths to fix comparisons on Windows X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2018 05:04:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao If no other comment, I will help push this change.=20 >-----Original Message----- >From: Chris Co [mailto:Christopher.Co@microsoft.com] >Sent: Friday, June 29, 2018 3:31 AM >To: edk2-devel@lists.01.org >Cc: Leif Lindholm ; Zhu, Yonghong >; Gao, Liming >Subject: [PATCH v2 1/1] BaseTools/Trim: Normalize filepaths to fix >comparisons on Windows > >When using Linaro GCC5+ arm-eabi toolchain on Windows, the generated >DSDT.iii contains a canonicalized ("\.\" removed and lower case) >filepath for the preprocessed DSDT.i file in the first line. >Trim.exe is called on DSDT.iii to generate DSDT.iiii, which does a >line for line comparison of filepaths encountered to the preprocessed >DSDT.i filepath found in the first line to determine what lines to >place in DSDT.iiii. Since the DSDT.i filepath is canonicalized and >all later filepaths in DSDT.iii are not canonicalized, all comparisons >fail and the result is in an empty DSDT.iiii. > >Issue was first reported to Linaro here: >https://bugs.linaro.org/show_bug.cgi?id=3D2909 >where the recommendation was to address the issue in Trim.exe. > >This patch normalizes the case and pathname of all filepaths >encountered during Trim.exe execution on preprocessed files. This >fixes comparisons of filepaths that contain mismatching case on >case-insensitive filesystems, redundant separators, and uplevel >references. > >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Christopher Co >Cc: Leif Lindholm >Cc: Yonghong Zhu >Cc: Liming Gao >--- > BaseTools/Source/Python/Trim/Trim.py | 2 ++ > 1 file changed, 2 insertions(+) > >diff --git a/BaseTools/Source/Python/Trim/Trim.py >b/BaseTools/Source/Python/Trim/Trim.py >index 76944c0e25b3..b46d507b4e55 100644 >--- a/BaseTools/Source/Python/Trim/Trim.py >+++ b/BaseTools/Source/Python/Trim/Trim.py >@@ -166,6 +166,8 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, >TrimLong): > if len(MatchList) =3D=3D 2: > LineNumber =3D int(MatchList[0], 0) > InjectedFile =3D MatchList[1] >+ InjectedFile =3D os.path.normpath(InjectedFile) >+ InjectedFile =3D os.path.normcase(InjectedFile) > # The first injetcted file must be the preprocessed file = itself > if PreprocessedFile =3D=3D "": > PreprocessedFile =3D InjectedFile >-- >2.16.2.gvfs.1.33.gf5370f1