From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.36.138; helo=nam02-sn1-obe.outbound.protection.outlook.com; envelope-from=christopher.co@microsoft.com; receiver=edk2-devel@lists.01.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0138.outbound.protection.outlook.com [104.47.36.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2457C202E53E8 for ; Thu, 28 Jun 2018 12:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OXOykFuH6pERIcamadghppjbYkkPoEc8O3ZlxL18CRQ=; b=G/vvVyZwFmXSJ859zZqDewkwwTjFzf2jVWM5z3f2a+NUsGkZsbhlyeTPSaPcy46ORlJo41okCz+6KpYRuIZbuEeRR6hwjDZuD1YM5dszkji5tRqgtOJMFk/dpfFQ3DfU6kiNBQVBsiUXqvl0AQYpC1S/NaFkzxY+Pmo/lnSZJDw= Received: from DM5PR2101MB1128.namprd21.prod.outlook.com (52.132.133.20) by DM5PR2101MB1110.namprd21.prod.outlook.com (52.132.131.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.2; Thu, 28 Jun 2018 19:31:21 +0000 Received: from DM5PR2101MB1128.namprd21.prod.outlook.com ([fe80::28cb:9380:49e8:e0d0]) by DM5PR2101MB1128.namprd21.prod.outlook.com ([fe80::28cb:9380:49e8:e0d0%2]) with mapi id 15.20.0930.005; Thu, 28 Jun 2018 19:31:21 +0000 From: Chris Co To: "edk2-devel@lists.01.org" CC: Leif Lindholm , Yonghong Zhu , Liming Gao Thread-Topic: [PATCH v2 1/1] BaseTools/Trim: Normalize filepaths to fix comparisons on Windows Thread-Index: AQHUDxaXJ2suAXJZ5UKtdx90UoWAxA== Date: Thu, 28 Jun 2018 19:31:21 +0000 Message-ID: <20180628193107.48332-2-christopher.co@microsoft.com> References: <20180628193107.48332-1-christopher.co@microsoft.com> In-Reply-To: <20180628193107.48332-1-christopher.co@microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BN6PR14CA0036.namprd14.prod.outlook.com (2603:10b6:404:13f::22) To DM5PR2101MB1128.namprd21.prod.outlook.com (2603:10b6:4:a8::20) x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [2001:4898:80e8:a:f531:6ea1:97fa:a8b9] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB1110; 7:fOhb3tmJr0wkwsmbjpdD6RSPcjencnSppdrffBtGoeDDy7oBirErziJswi5Pj6IzNUq50UUl7ox2KyC1kO9nvkqmPz+1QbcGHYtlkle1VVgPOEGycGzdvN+fwq0OiTu/3/C28kF6JHmOYhvbwiPhKBMqEBrsgLF/X7TgKAo9qEyLD+H9w3DlEMjklQ2GkNsK1S2EtnCazszaVY83FjCHwNddrKy3y+PGB9DZ6dtNxSCqd0zXZqZs5z1gXlqQbOmp x-ms-office365-filtering-correlation-id: 15b3c09d-a70e-434e-387d-08d5dd2dba10 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652034)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7193020); SRVR:DM5PR2101MB1110; x-ms-traffictypediagnostic: DM5PR2101MB1110: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231270)(2018427008)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DM5PR2101MB1110; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB1110; x-forefront-prvs: 0717E25089 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(136003)(376002)(366004)(39860400002)(199004)(189003)(486006)(81156014)(305945005)(76176011)(10290500003)(8936002)(2501003)(5250100002)(6916009)(10090500001)(2900100001)(22452003)(2616005)(97736004)(476003)(102836004)(72206003)(52116002)(575784001)(5660300001)(86362001)(478600001)(86612001)(256004)(7736002)(386003)(6506007)(966005)(6116002)(5640700003)(14454004)(6346003)(4326008)(54906003)(2351001)(106356001)(105586002)(53936002)(1076002)(25786009)(316002)(6512007)(2906002)(6486002)(36756003)(446003)(11346002)(81166006)(6436002)(8676002)(99286004)(186003)(46003)(6306002)(68736007)(460985005); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB1110; H:DM5PR2101MB1128.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Christopher.Co@microsoft.com; x-microsoft-antispam-message-info: NrvmmH44E3/BZX55lEUzxSTFaIWmYN5/cppoBFiXqA6D0fEl12rBjmNopqXUXLJ1tBcJPlRXJsb/6d9gLKrz2ef78Q/NcPsz+GY1zt5OtoymMQBM9JmOt1ApfmuG4zkGfJTkYfY8N8Bu+C8yYaTwHfsq37yEo+CGKODhkTqpQfGGq70X+lvGlL5Vhyxb1Hx4u7455+obwWca8OXs3U/Mszx0T/cAggTfjSEDriJA/8MY5B+SluR07DjjIG4ezox2RIQRR3Q4dmeUnnLI7fNioOgYwYoVUQAon5wysR3KTMmdxzx7OP9e7+GjDzYKV7VSTNYnsmAv0ssf58A9ccw3qZqPFfTyK7aNdQrvcMij1Ys= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15b3c09d-a70e-434e-387d-08d5dd2dba10 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Jun 2018 19:31:21.7061 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1110 Subject: [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: Thu, 28 Jun 2018 19:31:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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, Tr= imLong): 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 i= tself if PreprocessedFile =3D=3D "": PreprocessedFile =3D InjectedFile --=20 2.16.2.gvfs.1.33.gf5370f1