From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.4.61; helo=eur03-db5-obe.outbound.protection.outlook.com; envelope-from=evan.lloyd@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40061.outbound.protection.outlook.com [40.107.4.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 57BA8211F888A for ; Wed, 27 Jun 2018 04:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uJciEiFIJRDxK0R1L+LZ61qIB3Hxyk1DOU6F7Ulp/7M=; b=ePlLLU5F29vukbKUM6gdpBKZcpw4JzOrIYVSrNrigFXOw500sUaHV8YFSQQbJJ/pJOuWpb0Xi1DlxxeF4K6LBQ8N6FvTQI1AcxbedTYuDdToLYiX3122O6Sw2ZYXV5WNCdQQ9mG4yKQFVJxmYgmjm/ncimpwQG9xnv7Ich/xaZM= Received: from DB6PR08MB2806.eurprd08.prod.outlook.com (10.170.222.149) by DB6PR08MB2760.eurprd08.prod.outlook.com (10.170.222.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.23; Wed, 27 Jun 2018 11:35:00 +0000 Received: from DB6PR08MB2806.eurprd08.prod.outlook.com ([fe80::3121:feab:c41a:7885]) by DB6PR08MB2806.eurprd08.prod.outlook.com ([fe80::3121:feab:c41a:7885%3]) with mapi id 15.20.0884.024; Wed, 27 Jun 2018 11:35:00 +0000 From: Evan Lloyd To: Chris Co , "edk2-devel@lists.01.org" CC: Liming Gao , Leif Lindholm , Sami Mujawar Thread-Topic: [PATCH v1 1/1] BaseTools/Trim: Canonicalize filepaths to fix comparison Thread-Index: AQHUDcsNZUVBqOxBWkWwqrDKFPQJj6Rz8L2w Date: Wed, 27 Jun 2018 11:35:00 +0000 Message-ID: References: <20180627035753.49848-1-christopher.co@microsoft.com> <20180627035753.49848-2-christopher.co@microsoft.com> In-Reply-To: <20180627035753.49848-2-christopher.co@microsoft.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Evan.Lloyd@arm.com; x-originating-ip: [217.140.96.140] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB6PR08MB2760; 7:D8IHWmML+9BJYU9T/pptk9p49aVK4CWZPVDZW93D0+BXpojezWRQYlT2/yG8WGws+U0CJWxt1Tj8ZZXyyV1X/YAkGwUtJTtQYfDHxd3A0iIrGF//bFJfRcM7PVMWtgWr8QSX/6OrVFPBrHjwPmH48MtdQOS6KH8a59dDa2J0ivzIsc+Drg9gD/wychs8bRsrKFsFlJZHK7gdAJlNaTNqWBQMJHV6UZDSRa8mH0XnMUrFMZVZkZQ5TVhYFqIEL3zW x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: 45f4f328-0241-4cb3-61c2-08d5dc2204a5 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:DB6PR08MB2760; x-ms-traffictypediagnostic: DB6PR08MB2760: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(223705240517415)(788757137089)(162533806227266)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:DB6PR08MB2760; BCL:0; PCL:0; RULEID:; SRVR:DB6PR08MB2760; x-forefront-prvs: 0716E70AB6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(366004)(136003)(346002)(39860400002)(189003)(199004)(40434004)(13464003)(11346002)(53936002)(446003)(6246003)(4326008)(25786009)(476003)(97736004)(486006)(5024004)(66066001)(316002)(14444005)(2906002)(1511001)(5660300001)(3846002)(110136005)(305945005)(7696005)(26005)(54906003)(72206003)(966005)(478600001)(102836004)(6506007)(55016002)(186003)(2900100001)(14454004)(6116002)(53546011)(99286004)(8936002)(86362001)(2501003)(5250100002)(229853002)(8676002)(81166006)(6306002)(68736007)(105586002)(256004)(33656002)(9686003)(76176011)(7736002)(106356001)(81156014)(6436002)(74316002)(460985005); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR08MB2760; H:DB6PR08MB2806.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 56IPcdPCJDfp9AEklp7f3Ylj1A1oCIKOxt5dHvw27h5MxqjErrY6BbnDXaK5qTSFRztx5GMngBsq+wbpAnyRKrajbn0I7QMi8YPZGjw2E0ROb9n/AvFICqcFUaMk2QkUzxUEngh8nE5q575LEif/kxjGWOs167KjWuebv7DHyCVAkxgMUnazmx2OoNxTiw4CbX8HZp+jce3PHOlQH8NIFBlOr9amRbMWolaVqphzvMVx9AsDEB8vXxOJLJq/dgfrc50YKkxE9A5+caY4h2qOUjRvtTJZrC2TFpGx8rdPmjx2WiluUiYJlJ3iG19nlqzSFSRVOpaEsNN7bCILR+qFoToopYwBh2c3/F8TaFKnz5A= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45f4f328-0241-4cb3-61c2-08d5dc2204a5 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jun 2018 11:35:00.6801 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2760 Subject: Re: [PATCH v1 1/1] BaseTools/Trim: Canonicalize filepaths to fix comparison 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: Wed, 27 Jun 2018 11:35:05 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Chris. Firstly, thank you: this is a useful, pragmatic solution to an major annoya= nce. I personally think it unfortunate that the GCC guys can't be bothered to fi= x their compiler, but ... > -----Original Message----- > From: edk2-devel On Behalf Of Chris Co > Sent: 27 June 2018 04:58 > To: edk2-devel@lists.01.org > Cc: Liming Gao > Subject: [edk2] [PATCH v1 1/1] BaseTools/Trim: Canonicalize filepaths to = fix > comparison > > 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. > Due to this, when Trim.exe is called to generate DSDT.iiii, future filepa= th > comparisons against this canonicalized filepath, which should match, actu= ally > fail the comparison which results 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 canonicalizes and lower cases all file paths encountered durin= g > trim execution on preprocessed files. Since file paths are standarized, = the > comparison succeeds for files that should match regardless of the presenc= e > of upper case or "\.\" characters in the file path. > > 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 a74075859148..cca4e5c9694a 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 InjectedFile.replace("\\.\\","") [[Evan Lloyd]] I've not actually tried this yet, but it looks surprizing. = I'd have expected InjectedFile.replace("\\.\\","\\"). Can I ask how it works, please? Have I missed something? [[Evan Lloyd]] Would it be possible to achieve the same effect with os.path= .normpath (see Common/LongFilePathOsPath.py imported via line 17)? > + InjectedFile =3D InjectedFile.lower() [[Evan Lloyd]] Similarly, there is "os.path.normcase" - but that may not ge= t the comparison working (because it converts '/' to '\' on Windows). > # The first injetcted file must be the preprocessed file= itself > if PreprocessedFile =3D=3D "": > PreprocessedFile =3D InjectedFile > -- > 2.16.2.gvfs.1.33.gf5370f1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.