From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.2567.1589336176182343133 for ; Tue, 12 May 2020 19:16:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=FszhmG04; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: bob.c.feng@intel.com) IronPort-SDR: Opxg+a6uCNWFQtDz1CyOoYluoVZh+r9y3ZgOn3nR57xrElprpJGajRsaagHGEtL2kMz8QKFpYi 3SN7kUrzf8YQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2020 19:16:15 -0700 IronPort-SDR: j/26rKIcvE+ufe69YJqghvhQ6OnMwahR8FtnGF4MtvYQ335QS2uYbjlqEEDGFZTNjRu/TnVsyu vA0ex5+zPLgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,385,1583222400"; d="scan'208";a="251634689" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga007.fm.intel.com with ESMTP; 12 May 2020 19:16:14 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 12 May 2020 19:16:14 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 12 May 2020 19:16:14 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.176) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 12 May 2020 19:16:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/2bs7BxdstlG34S5dqoNGKwcxhkL4KnRaObGib9R97IH1U7nmLfb3s0GLv/+ilQxaJKlDIJrqnnEx2M/Debk+d17CLpNNpzZ708U2s4SKaW+0vlXdyTaSzkIRQy14rdeJGW7UqAnvJ+O3CZLwSsz4Ed4TaskcYGrQJCIUS0coWIxjsrbIwDdAE6ewT08is6BILNEY0UMheTWIHkgzT+uVn11EYFegTn3wLcxXDAgj7lDRbvpRLPslOjuWR3MENfO6G/f16ZC3B7ij0TlYs6huAq7oowPvno2BmOKDUWZxqS2WhComsl1Z6UfBYTj074e/tqqoDBdF74JWUjU+ieLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wSrHhmx+Q6gs2Os6U9v9u+xbn8vjF03ENnYKfjwsfOc=; b=jREyRPqcDUHWJB3SwMeMoFG4XSzLfkPza3cyqSmhxhU0HSRP5WKt3rQRIy2AMpZoZertjl/PhkWwQ7NRDzIAAuakGiyWmqGjxcvCp7NW7hJurj18D4ONVpJ3d63OMfgQRz6RMoG68zMIABXiCLecINkdn2HttlYcbugRpKdjRi9fpBDzDVUdZskKD47F/gIa8UiMR1D0T6Y6EfrJIbT0yBPSmjBbpPcTAGSN18XD680layCL8WLocT/ntPN4BORwIxBoRkSsd/tdxE+Y456hZlgQ+8BMEqtFnwa5ptf0p5q+Mnpu5dRCzCzHyTLcsw6khkuSZcDiVlYsBYWWEOPM0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wSrHhmx+Q6gs2Os6U9v9u+xbn8vjF03ENnYKfjwsfOc=; b=FszhmG046VEvPVTAt8y+gS41HAAxpCdUjnp5YrQvoUTN1QpkOBqRahNw6yDQLd4JbTeAfyRfMwqKvNPUAeHl93LrOr0mDxhpSTbfpk3nZX1idNkxtnyA8SLB+yaGlf9cyeylKPhkYgpQKd3mxZCYoGeNLEsCqfccmswnPoO2esA= Received: from BN6PR11MB0068.namprd11.prod.outlook.com (2603:10b6:405:69::17) by BN6PR11MB1716.namprd11.prod.outlook.com (2603:10b6:404:4a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.33; Wed, 13 May 2020 02:16:12 +0000 Received: from BN6PR11MB0068.namprd11.prod.outlook.com ([fe80::2d53:d47c:1269:d601]) by BN6PR11MB0068.namprd11.prod.outlook.com ([fe80::2d53:d47c:1269:d601%6]) with mapi id 15.20.2958.034; Wed, 13 May 2020 02:16:12 +0000 From: "Bob Feng" To: "Feng, YunhuaX" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [PATCH v2] BaseTools: Fix parse PCD GUID expression issue Thread-Topic: [PATCH v2] BaseTools: Fix parse PCD GUID expression issue Thread-Index: AdYlltPkpPR5gtLaT96kAdPrXw353wDNZ+TA Date: Wed, 13 May 2020 02:16:12 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.45] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3428573a-72bd-41c5-a278-08d7f6e39bdd x-ms-traffictypediagnostic: BN6PR11MB1716: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:330; x-forefront-prvs: 0402872DA1 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vRxQjuvJ0QARvEqqoJ9GEUQDQJvqtH2MG14rlIyzhFYNs04lmuyCXfWdg6Amqr2wabUTNgq+hmphqImlRxuBuS1GO5r0jHBvn/jpj67zQ0JCvV1zzQY+2BiqNri2Y1ePMLw95pM60iAfDlyvT4/STZOud7cv2XUb8A+FvQRNiJ7dYKSM/1YyNPWxWW7MAaTQQXbzmnSdSYYUBYQb4CrMgO0ZeXDwFvcIACPx0cnWeqP0YspBkB+b4JtTS1Kyw1/3MPD1meyRlABF8oAU+msf+O3I3GjYiA5roerqbxArB4A548F7KHLabT9MTG905HJdtSVJjMzWlK7+y/BcClzQ4U3PFIy8AttzJ0YvyG6HKHD1+OoH6/Y3SBI5Whcpq5hFKTbIzMqighhZ8n23z75+0YITEQQevROr4Gb1LsHPQACeY8BCB4d0jbcRqxYAYxFi9WF/Bo4ZowYytYgrJrGD65QSP6VHEaM2uPniVYohZpzF2R/Vab6xc4QFztn3ghF09Yjh7qbvvC3Bb53Av02eoJgG7QeE4JQ5ktYOJC9Ey5xHTHsJJ6ryrru1uuSUrsN0ITI3GwyF1JFbgG6MwwdZ3y40rY21AMmmjYkRzQJe9ng= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR11MB0068.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(366004)(136003)(39860400002)(396003)(346002)(376002)(33430700001)(86362001)(186003)(6506007)(55016002)(8676002)(26005)(8936002)(7696005)(316002)(71200400001)(9686003)(5660300002)(4326008)(66446008)(107886003)(2906002)(53546011)(478600001)(110136005)(966005)(64756008)(52536014)(66556008)(66476007)(33440700001)(33656002)(66946007)(76116006);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: Pd0aflY8aLi3n7nj948cE3Bm2OdsIx7XWOgL/5cTFKj51EmGSw+iCAIpgb5DtjAyU3W7YytcsnwwDsg21ol8OrARXw/GL+rd+WiQchIB/StUCMlSbMWd2U+hpLfWfpwkOTGB9NYtH06dSA8p45p7XvN4QcXWfC+7n1qu/GOLuvcbC/TDLHrX9EJn77d3y6KR5rdGWXIaecy7K7eNl7OwptuHKrkUtOtJMkkfT6qsg6UJjTbkEo8XywA5UWxafj3lRzvdIkkFNd3kGMyKfc+YWceORs1jaAEvZexA0VcY970mf3EssUiKciIxU5ihzvi6GxRgy1MErPZs4icOVvxKPRGm6c1z+mQCOX+zX9KKiXZsfHlS8ZiQFSjVp0vYvwJ7twsUCc/9JNnT3EM1qt+VoitrxdgqyHaScjdfoZWy+ah0/I+0INbhahNI0Ny35FadL0SRx/vIdAjhaxNFaLRstbjd6fWrKKtTcAmtp7+wbzxPkRLsE4SSwn209RnZ5yU+ MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 3428573a-72bd-41c5-a278-08d7f6e39bdd X-MS-Exchange-CrossTenant-originalarrivaltime: 13 May 2020 02:16:12.6711 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: doq3bzLkGvpO2QdwgXOUntWpxeVjMr+bHjPK0kdHEzb7LedTldx5mgxCuOh/Lh6FwNRsal027dvi9gZlc0kpMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1716 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Feng, YunhuaX =20 Sent: Saturday, May 9, 2020 8:15 AM To: devel@edk2.groups.io Cc: Feng, Bob C ; Gao, Liming Subject: [PATCH v2] BaseTools: Fix parse PCD GUID expression issue REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2686 The build tool will give an incorrect GUID value if the GUID includes chara= cter ' or " ASCII value. This patch is going to fix this issue. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/Common/Misc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index da5fb380f0..ad55671080 100755 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -37,10 +37,11 @@ from Common.LongFilePathSupport import OpenLongFilePath= as open from Common.LongFilePathSupport import CopyLongFilePath as CopyLo= ng from Common.LongFilePathSupport import LongFilePath as LongFilePath fr= om Common.MultipleWorkspace import MultipleWorkspace as mws from CommonDat= aClass.Exceptions import BadExpression from Common.caching import cached_p= roperty +import struct =20 ArrayIndex =3D re.compile("\[\s*[0-9a-fA-FxX]*\s*\]") ## Regular expression used to find out place holders in string template g= PlaceholderPattern =3D re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.UN= ICODE) =20 @@ -1153,17 +1154,16 @@ def ParseFieldValue (Value): raise BadExpression("Invalid GUID value string %s" % Value= ) Value =3D TmpValue if Value[0] =3D=3D '"' and Value[-1] =3D=3D '"': Value =3D Value[1:-1] try: - Value =3D str(uuid.UUID(Value).bytes_le) - if Value.startswith("b'"): - Value =3D Value[2:-1] - Value =3D "'" + Value + "'" + Value =3D uuid.UUID(Value).bytes_le + ValueL, ValueH =3D struct.unpack('2Q', Value) + Value =3D (ValueH << 64 ) | ValueL + except ValueError as Message: raise BadExpression(Message) - Value, Size =3D ParseFieldValue(Value) return Value, 16 if Value.startswith('L"') and Value.endswith('"'): # Unicode String # translate escape character Value =3D Value[1:] -- 2.12.2.windows.2