From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web09.2736.1648297924430108524 for ; Sat, 26 Mar 2022 05:32:04 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=f9Mool6H; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: bob.c.feng@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648297924; x=1679833924; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=aW0CYZt8N1kQOnpXYjDzscw2U4B7JhjIzrtkuLRpJe4=; b=f9Mool6HuaRByXa0s2lmecqp9HV/Rrou0o3ilaO+IVTLxdNaQA0GuaC/ 9hsfGKawjEfgD9O0zptYqCP5XpNzt0wXavFscNcFNDByCNa4jUrgEHbk5 i+9+80c2DzcRXQ3BbK1AlA9L//WCsH3uFDsMdhT0dT7J32vNXgMJgLQtj t4kza0iav/Ey3VLqmMzAkbQrEq/PW4NUEH+04aC/YKh6aZ/6ekfJaawz/ 6rN4eFvAfgUImUmRIbdeFZhuI4YiqEeYCYIjSwrlmo+I8Ib1sDDlfj84+ aP0aPtJ4rJxEbKv313jE6mEBhGfwniz9x8iPf3eLHO3XMlWtkhZnm5hRy A==; X-IronPort-AV: E=McAfee;i="6200,9189,10297"; a="258967919" X-IronPort-AV: E=Sophos;i="5.90,213,1643702400"; d="scan'208";a="258967919" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2022 05:32:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,213,1643702400"; d="scan'208";a="826268537" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga005.fm.intel.com with ESMTP; 26 Mar 2022 05:32:03 -0700 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Sat, 26 Mar 2022 05:32:03 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Sat, 26 Mar 2022 05:32:03 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.177) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Sat, 26 Mar 2022 05:32:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jy453U6eQKgKegIS6aGRT7DdVVFAb1FkA45XK7q6+3Lgn/moG1t/ejKJX80rewdHLxIFkFNyO4Y3MM7HJh65TFeQR0w91qghekACP8GOZyR66Xu2PvGA94/5th4LPtu6KlJiapT6GsClLnXGqkSMyLVtPRmK8ZqLT6dCDjhH/KHvoYCso6gH6iHlvDirFElGfBsQqRHj0DrG76EdjF/OeJBAX6x94Rj/ABFCZnJUd9G/XNg0gUk9J1ac74in3YV4befC3N+LiKq9cx9Nx9rpN2m4/M0H5X8KCLwLW4OkLtKm8njq7X0pznhp9dy7+0KiLB+eHVIfm8zcFV6eWLxeSA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p0xjSkZ9KJ3LrrPfPldEc1DmcXHQLOptQVQMPSlBaBo=; b=mgWFg2U4kYlPzVTEdUmvvip1CuJ2FuZQW7KYA2cd/c61500uIUmTsglAsXDWEba5as/rpl+E5xxJRs9MihAWwpI5Ruwtqe2uqdYibeeJhKsybx8LHihroYBu12XPaLQsjBt38KfzqXBxPxDwjRccFLtYm3iKI545Kk2C/co25ImORbImx1nMBBOdJ1MqtqsfC4ri387M6RLhkCuGINQ6Ern0fh9aLdr5leOQIEnhjDfLzPbCLGBQ52TBgOZoehVj3srZklWO0/xnzVCHORcaWZDE9JF1dC72sXF+WB+ba/8xARJt8L6ibQkHQ0BUmxFrlEEetwhepY2c+vTzZr1fdA== 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 Received: from PH7PR11MB5863.namprd11.prod.outlook.com (2603:10b6:510:135::11) by CO1PR11MB4771.namprd11.prod.outlook.com (2603:10b6:303:9f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.16; Sat, 26 Mar 2022 12:32:01 +0000 Received: from PH7PR11MB5863.namprd11.prod.outlook.com ([fe80::9cca:b173:d2c9:1d21]) by PH7PR11MB5863.namprd11.prod.outlook.com ([fe80::9cca:b173:d2c9:1d21%3]) with mapi id 15.20.5102.019; Sat, 26 Mar 2022 12:32:00 +0000 From: "Bob Feng" To: "devel@edk2.groups.io" , "xiewenyi2@huawei.com" , "Gao, Liming" , "Chen, Christine" CC: "songdongkuang@huawei.com" Subject: Re: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools:Support decimal version number in ECC check Thread-Topic: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools:Support decimal version number in ECC check Thread-Index: AQHYOo7uQefEBS++YEiF+oCMnAJoQ6zRpbxg Date: Sat, 26 Mar 2022 12:32:00 +0000 Message-ID: References: <20220318060924.480865-1-xiewenyi2@huawei.com> <20220318060924.480865-2-xiewenyi2@huawei.com> In-Reply-To: <20220318060924.480865-2-xiewenyi2@huawei.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.401.20 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9ce0c4be-ee3e-49b8-2b85-08da0f24a046 x-ms-traffictypediagnostic: CO1PR11MB4771:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: kN/1u3CCyZdcyjaHcPSRYVgL3RMzsN5Gcz2EjApBzPziDz6Uxm1EkZQ9rJ/o4wtRicspdXEpf+ag1wCg2Yuy7MvWTo/Ga0GM2OWUEYI9nxd6imXY6e8QSF8cW5ndD3qKytYhFUodPouI/4FZrkXaRw0Dgxi4CUf/88EYtjY126K1APsQnntSM5VL6B+NW1a5rK+jZgs+RcgQvwgfEreYC3crWfTc6ReeXYwvput2RzCb1vNnZMa/VqAvmUWXMLA/C1F87BAJoIa2NK38v5seTI/c3xFDInfhUahVibIeCDQBiJuFIO6Co7DgTLc/wAdZldxwRq6WKzEBb58HoYu9bPdP69W9/Nn6IjHvj7zvUh4ZHppUxOrEcMT8C8K1Z+KawOn/xBc0kly4oeYgzTA6wwct0OUFrxiS9vXyjLvElJadqHGkTzUUk3bM80KFoJDqx0YkeVRHoBg03931FkM0qWCJv5D+AeJj4niRsfu8nvD8H1yGMuN+9IztylFYvyfGfqZ88QZhqkVjmkS6xJ1VJzmq/Yqqf919i2SkBL1KQ8foVow5y2Iq37uV8XyrCGJ86K+zWP2x5V+OdSThY+z/qdKdxnmU0CX7sNow0JUFP7bEneNSHLCdQlAW+Qp1U7M634imSbB7cTPslykk7cyjO9uVZJYYp4uC1sV6Ydvr8vUfMJ6L9RzZE6s+4T0zggeidNBO8OLvVciVlkbYrFnzilG9ftX9SQwStrESh5/U7kEuP+rydiqqid+Li8Y9pe9HvhGKdyFcgriFG3EUB53N9mpvwz+fAu2EbdLQMwA2FeECekKMf0eqHUXN6DdYdqWAd0zr0q2S0cSVlF46HLUQDA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR11MB5863.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(71200400001)(5660300002)(33656002)(83380400001)(52536014)(2906002)(38100700002)(9686003)(38070700005)(7696005)(82960400001)(55016003)(53546011)(6506007)(316002)(6636002)(110136005)(966005)(8936002)(508600001)(86362001)(186003)(122000001)(26005)(76116006)(64756008)(66556008)(66476007)(66946007)(8676002)(66446008)(4326008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?q/IAVGajL5oIs0bWJCNTl2Oh4p9Enc9QpOt5wCGMYIjJ8+aPaDR8OYJqurJV?= =?us-ascii?Q?5jYAt6A/6F2nr4504YpWTsFpUVUdt0U52tmGzozybgn29c4x4K6sbYhqwfim?= =?us-ascii?Q?e/JIsMkd3C8MZIrS6gcqWthlWDliNzjnLXTlRxKQy/QtABMgSoqU+c5NCha9?= =?us-ascii?Q?Vbe86bCeLweWtR1barPujiwd6Txmekvxikz9rnPfbwzuRTEoOiSRJUrV5VtA?= =?us-ascii?Q?fhUYlsod+71Q5qPoiEyeXn3zjKOgcOj9/MB7PSVklEcHMWdBPjjf6wSoxksT?= =?us-ascii?Q?bX42Ekges6mknWAwCILQwiTwMZJ5GZKRI8yA0dBD1iHiRXwjuxWSav2C2R1u?= =?us-ascii?Q?uwoc3TZsOMIAxQaObE5onIRhECPKgIB33of3L6OTtiyYZEATMJSk/iCG1lzn?= =?us-ascii?Q?jMI6Lpx7Vr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N/xgaok?= =?us-ascii?Q?bB5Rj6lHS+d2BL6FRPzCttZHJBFlUSN41DskAhemN1ygA88uQDkSSHHjPaKN?= =?us-ascii?Q?VsdONVbwH8IAGFU4DQJZwiQ6ijXJIYiE8kyrTbwXDHdq9ZtpRBNIsgeWuDm9?= =?us-ascii?Q?1DHE09DNY11QgkkT61LIxL21lp3VrOMlU6ePrHl9N2pIxfCH010QT5AlB+ZE?= =?us-ascii?Q?JPz9eMuwA7dP5E9VZyXyfK50wYCHt0mVlzqfOprEMYCcxf3ID+6q7I2RYq0N?= =?us-ascii?Q?ogPBgnCTE3pvSFZvlCtFfw3uiV3ldfsjU5KR/PDPh2IH/t/Wi7mZQ+0TGn7u?= =?us-ascii?Q?ktXIpxc/KHtPjmZmRsbflH6/JXTPxmp+hNP5eFI8UbJP44FbYm/u2Tuibj+H?= =?us-ascii?Q?8mqQFR5KxD8QHo6gkjnV5vS9f7dv7LxYpBtcUqggyT8h5OmvXTCuRq1SWf6j?= =?us-ascii?Q?l/wMqzWKCg=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB5863.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ce0c4be-ee3e-49b8-2b85-08da0f24a046 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Mar 2022 12:32:00.7757 (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: 6yadTjZzQ3LPZCz0CXrfF0BNMhutLKItfqwVUZTIy0rwudanjv4oKdSQpAd71GBdsDts0uJ7xL7GuHkuS+UNdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4771 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 This patch looks good. Reviewed-by: Bob Feng -----Original Message----- From: devel@edk2.groups.io On Behalf Of wenyi,xie vi= a groups.io Sent: Friday, March 18, 2022 2:09 PM To: devel@edk2.groups.io; Feng, Bob C ; Gao, Liming <= gaoliming@byosoft.com.cn>; Chen, Christine Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com Subject: [edk2-devel] [PATCH EDK2 v1 1/1] BaseTools:Support decimal version= number in ECC check REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3872 When doing ecc inf version check, the decimal type version number like 1.27= is treated as invalid version. So the code should be updated to support decimal type version number. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Wenyi Xie --- BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 18 +++++= ++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.p= y b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py index 9c27c8e16a05..2d98ac5eadb2 100644 --- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py @@ -31,6 +31,10 @@ from GenFds.FdfParser import FdfParser from Common.Long= FilePathSupport import OpenLongFilePath as open from Common.LongFilePathSu= pport import CodecOpenLongFilePath =20 +## RegEx for finding file versions +hexVersionPattern =3D re.compile(r'0[xX][\da-f-A-F]{5,8}') +decVersionPattern =3D re.compile(r'\d+\.\d+') + ## A decorator used to parse macro definition def ParseMacro(Parser): def MacroParser(self): @@ -331,11 +335,19 @@ class MetaFileParser(object): Name, Value =3D self._ValueList[1], self._ValueList[2] # Sometimes, we need to make differences between EDK and EDK2 modu= les if Name =3D=3D 'INF_VERSION': - try: + if hexVersionPattern.match(Value): self._Version =3D int(Value, 0) - except: + elif decVersionPattern.match(Value): + ValueList =3D Value.split('.') + Major =3D int(ValueList[0], 0) + Minor =3D int(ValueList[1], 0) + if Major > 0xffff or Minor > 0xffff: + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid ver= sion number", + ExtraData=3Dself._CurrentLine, File=3D= self.MetaFile, Line=3Dself._LineIndex + 1) + self._Version =3D int('0x{0:04x}{1:04x}'.format(Major, Min= or), 0) + else: EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version= number", - ExtraData=3Dself._CurrentLine, File=3Dself= .MetaFile, Line=3Dself._LineIndex+1) + ExtraData=3Dself._CurrentLine,=20 + File=3Dself.MetaFile, Line=3Dself._LineIndex + 1) elif Name =3D=3D 'MODULE_UNI_FILE': UniFile =3D os.path.join(os.path.dirname(self.MetaFile), Value= ) if os.path.exists(UniFile): -- 2.20.1.windows.1