From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.intel.com; envelope-from=yonghong.zhu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4C9C0210C2791 for ; Wed, 25 Jul 2018 18:42:13 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2018 18:42:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,403,1526367600"; d="scan'208";a="219154577" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 25 Jul 2018 18:41:55 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 25 Jul 2018 18:41:55 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.100]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.173]) with mapi id 14.03.0319.002; Thu, 26 Jul 2018 09:41:52 +0800 From: "Zhu, Yonghong" To: "Carsey, Jaben" CC: "edk2-devel@lists.01.org" , "Gao, Liming" , "Zhu, Yonghong" Thread-Topic: [edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION incorrect Thread-Index: AQHUI8lQvB3Iiwa+MkSCgpMnySLdH6Sgqx/g//+FtwCAAIsNoA== Date: Thu, 26 Jul 2018 01:41:51 +0000 Message-ID: References: <1532490041-516-1-git-send-email-yonghong.zhu@intel.com>, In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools: Parse decimal format INF_VERSION incorrect X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jul 2018 01:42:15 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Good, the patch is not push, I can update it. Best Regards, Zhu Yonghong -----Original Message----- From: Carsey, Jaben=20 Sent: Thursday, July 26, 2018 9:24 AM To: Zhu, Yonghong Cc: edk2-devel@lists.01.org; Gao, Liming Subject: Re: [edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION inc= orrect Can we change the code to allocate fewer strings? '0x' + '{0:04x}{1:04x}'.format(...) Could be just: '0x{0:04x}{1:04x}'.format(... Jaben > On Jul 25, 2018, at 5:41 PM, Zhu, Yonghong wrote= : >=20 > Reviewed-by: Yonghong Zhu >=20 > Best Regards, > Zhu Yonghong >=20 >=20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Yonghong Zhu > Sent: Wednesday, July 25, 2018 11:41 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming > Subject: [edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION=20 > incorrect >=20 > From: Yunhua Feng >=20 > hex number 0x00010019, the major number is 0001, the minor number is 0019= . > the decimal number 1.25, the major number is 1, and the minor number=20 > is 25 >=20 > Fix https://bugzilla.tianocore.org/show_bug.cgi?id=3D921 >=20 > Cc: Liming Gao > Cc: Yonghong Zhu > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Yunhua Feng > --- > BaseTools/Source/Python/Workspace/MetaFileParser.py | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py=20 > b/BaseTools/Source/Python/Workspace/MetaFileParser.py > index fbfc182c8b..250cbf79a9 100644 > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py > @@ -374,13 +374,16 @@ class MetaFileParser(object): > if Name =3D=3D 'INF_VERSION': > if hexVersionPattern.match(Value): > self._Version =3D int(Value, 0) > elif decVersionPattern.match(Value): > ValueList =3D Value.split('.') > - Major =3D '%04o' % int(ValueList[0], 0) > - Minor =3D '%04o' % int(ValueList[1], 0) > - self._Version =3D int('0x' + Major + Minor, 0) > + Major =3D int(ValueList[0], 0) > + Minor =3D int(ValueList[1], 0) > + if Major > 0xffff or Minor > 0xffff: > + EdkLogger.error('Parser', FORMAT_INVALID, "Invalid v= ersion number", > + ExtraData=3Dself._CurrentLine, File= =3Dself.MetaFile, Line=3Dself._LineIndex + 1) > + self._Version =3D int('0x' +=20 > + '{0:04x}{1:04x}'.format(Major, Minor), 0) > else: > EdkLogger.error('Parser', FORMAT_INVALID, "Invalid versio= n number", > ExtraData=3Dself._CurrentLine,=20 > File=3Dself.MetaFile, Line=3Dself._LineIndex + 1) >=20 > if isinstance(self, InfParser) and self._Version < 0x00010005: > -- > 2.12.2.windows.2 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel