From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.1939.1588983288433049617 for ; Fri, 08 May 2020 17:14:48 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=CBnTj9W6; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: yunhuax.feng@intel.com) IronPort-SDR: TTbG6YGmeJBA2e9rF3YMF5eUbtESGtKOufZuGmxjEwXUmRgGrxPO3R+9pYD47uHkzxaLXuYVNB 0grLCNMWN6pg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 17:14:47 -0700 IronPort-SDR: Lnz674fN25YBK74Nlg8VlrjbQczcoIo4+l5sHC6iXkgLT6UUjQT+WB+Rb51E21J0g4PDBNvGCA xZTvImIjNQLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,369,1583222400"; d="scan'208";a="250609337" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by fmsmga007.fm.intel.com with ESMTP; 08 May 2020 17:14:47 -0700 Received: from orsmsx122.amr.corp.intel.com (10.22.225.227) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 8 May 2020 17:14:47 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX122.amr.corp.intel.com (10.22.225.227) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 8 May 2020 17:14:47 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.53) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 8 May 2020 17:14:47 -0700 Received: from BN8PR11MB3793.namprd11.prod.outlook.com (2603:10b6:408:86::23) by BN8PR11MB3795.namprd11.prod.outlook.com (2603:10b6:408:82::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.33; Sat, 9 May 2020 00:14:45 +0000 Received: from BN8PR11MB3793.namprd11.prod.outlook.com ([fe80::6455:7f80:a3b2:730b]) by BN8PR11MB3793.namprd11.prod.outlook.com ([fe80::6455:7f80:a3b2:730b%5]) with mapi id 15.20.2979.033; Sat, 9 May 2020 00:14:45 +0000 From: "Feng, YunhuaX" To: "devel@edk2.groups.io" CC: "Feng, Bob C" , "Gao, Liming" Subject: [PATCH v2] BaseTools: Fix parse PCD GUID expression issue Thread-Topic: [PATCH v2] BaseTools: Fix parse PCD GUID expression issue Thread-Index: AdYlltPkpPR5gtLaT96kAdPrXw353w== Date: Sat, 9 May 2020 00:14:44 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; 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: a365aa3f-b3e2-43cb-51f3-08d7f3adfa81 x-ms-traffictypediagnostic: BN8PR11MB3795: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:873; x-forefront-prvs: 03982FDC1D x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: n/P6iIS178+AvKBB23DQolYJhFKn4inkbKSrnviNVcOUEuE7k/1B+yvohzUNcLccWaIOOjRQ5V3ZCkMLCpZMklfkIT0ENGkpxoVz9wdpmJDLaq08qOibXwICPt9Jn7eQUVuP+2g1Dc7VIfG3vaEWvlaw0tLfo/jxc4wE1S7xHu/FXorIvrsVIO5JO15+lqvuAtNT5Y+1bRO84Pv5LD/NGceUsDCBjaFMriRW//yF7/LIudJLytXo9+stfMjHPRw2meKpsLAuKvcgh71Z542o2em6Qzyao9PpM4OZGDwoPukGTHHEbMGHkj7mXOsvHg+pHtvFLBOd0ZWSnMb5LBN+Z4XsC71k3yRQRbLWdCkywLlqk2AUIDcpL/zuptqkmkEhHUjyNpvV0TdwRr8ql2CUNalDk6fG6Lswpv//eRBp0i//kZrS3Q9Q3QxkGPim7TWMMAcFKp1sTZ6a1Qa0hyxMyJgMjD+osu1OIKcamAObVUIiJMBNfwDzSTFaSXgwgJ3rOv/Z2ZJ7NYqUQPiAEjy0V1YLyzRQfPOiqptap5yKTWQe6Abp6P46OQUwA+ZRXMNx0piDidrav5Wgwgp/QM5e6If0uUhzM2ggyLMjv8uKCtQ= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3793.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(346002)(376002)(396003)(39860400002)(136003)(366004)(33430700001)(71200400001)(33440700001)(8676002)(186003)(86362001)(5660300002)(7696005)(4326008)(6506007)(76116006)(107886003)(966005)(66476007)(64756008)(54906003)(66556008)(66446008)(2906002)(66946007)(316002)(6916009)(52536014)(478600001)(55016002)(33656002)(9686003)(8936002)(26005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: KZJGoJX0QmwSF+PWsg+EJi+hnAXag3ykma9rAzCzGWt7axbqEmeR2Y1zo0DlXfF/gMKM14iYWl+DhfMgnsT8CWrLC46ypDIZ8dCtp/o2B87SiYe6FT7RDOo9KM+j/wTT6EERpSGL+lZkOjPM24jgwUXMlFcl5l94uLIVbDDK0/ps3M6FLW6xLt8T7uPFSkQJVX/1sSiAQyiCZNliRGTWXh/MFh9mXcaGSEJuvaLzpNeN3gC/u6T17aHWfgT/mOyM0uO5zxbTWW4ABCwMFTdQ2VecrkbI83udxedSSp6C9OBUKTd71s15mVmKzHs1t8hTgC0K2tNWTgzOI6wG8m8EisIE+jdc8yj2irJ0f1HxMOlWEXlGd5w5ZrI88jBIsQ056U+IPDk11Uk8FlFcdZXXnmiUISeVewL4kTzikLFtpwYo6ra8zIFpDKPl1YzjUBT6mE+VXajvDqoEjBXvIB9GL2odhRs2eUj96RdfX3oqrgs3s1H+exLdypO/G5saakmF arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C3Ah3Etb/s+3sWRIZg6zu5GHk8MUm97bDczLQF9yq3zANtXztKZ/EKyPiba4/bF0KVhEIR4L0uS1DVPC27J4Z1lfHuDZDwbSRLgAE8/w5c6ehgcAdpVmd3g5U0MMysTWVy+/+0ggfrehK2dDADjjEU8HfrXCqGXx9hFuZaxaEiP0ZOVrnw5O7gdB5N+ZeVjuD1pk7zhIs9TM/qhG8rHpnBNkyJ2QNQRAAwgQJbt8MxnzzyBUzXI7TZOSeiNs6TPYfbEwP4YhpT4HCFeEg39GxvJCXhgZO7DKfDJ7+ndL2zYplayV+eOcOXicazbfs2wr3iFqdADhYtNaZ0OZIt1Ndg== 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=DBgf6EG1BYbiNrfs0kAMmwMhHwyixggdoUBu4yX/Ac8=; b=ZzRsDM++zIv/i+xt8HL68QKsWxLo8fuSBTWm3YgS7iQ/dFz9ZYRTGvN2bgfXP+lL3Ww6UnXX5Ny+gmb6TXDDFGZuejYd/DvQH1eYlw8K2RQfLBu1TXpGrdROdsv6maDyxnwbPwFN/fbZa64rMjIlAaUua8xI5DWYs+dfZns//S0gwoWrLCQdY7bFlPvEQM79eF7XdSJOYdOVm1yInrgfesptVTNp5hcTnJPWxrrnxhJhgcaokDMpbMOsB5cTDjDxEzCgBYgDl4lXST66/gnpJN+U/jHhhEXoumAEmOngdck9Bdw2fK2xu/hWSsuVxEyBXjBW12jQ3WEUKcRKLafHEw== 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=DBgf6EG1BYbiNrfs0kAMmwMhHwyixggdoUBu4yX/Ac8=; b=CBnTj9W6sIPA21CE8+tzojHIWmOhYNTvoF+ohfIrUOltgrHoNJLefe9337+kNJCm51o0CA7k9Qy5ZGZmweZ9+p8SeCUxx7tZMUEHidcKYqDWlw7Wvmiwog/KlzXgUy9EJX6EhL8d5n1zrrdCHtUe+lRHTe6BJLaDlV6ahQ/+DAU= x-ms-exchange-crosstenant-network-message-id: a365aa3f-b3e2-43cb-51f3-08d7f3adfa81 x-ms-exchange-crosstenant-originalarrivaltime: 09 May 2020 00:14:44.7199 (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: Q/2mLwhrl6SN+/MTOiUkTxkYKO5QzyV75aCwzyzUQOcbI7bGhcBtoxSpR+ShCP7IbhS7AnYTs/5+8uoqkjS6Vw== x-ms-exchange-transport-crosstenantheadersstamped: BN8PR11MB3795 MIME-Version: 1.0 Return-Path: yunhuax.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 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 +import struct ArrayIndex =3D re.compile("\[\s*[0-9a-fA-FxX]*\s*\]") ## Regular expression used to find out place holders in string template gPlaceholderPattern =3D re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.= UNICODE) @@ -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