From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: bob.c.feng@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Sun, 21 Jul 2019 21:07:23 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jul 2019 21:07:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,293,1559545200"; d="scan'208";a="171516633" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga003.jf.intel.com with ESMTP; 21 Jul 2019 21:07:22 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 21 Jul 2019 21:07:22 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 21 Jul 2019 21:07:22 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.232]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.110]) with mapi id 14.03.0439.000; Mon, 22 Jul 2019 12:07:20 +0800 From: "Bob Feng" To: "Gao, Liming" , "devel@edk2.groups.io" , "Chan, Amy" Subject: Re: [edk2-devel] [Patch] BaseTools: Fixed the mis-using strip() function issue. Thread-Topic: [edk2-devel] [Patch] BaseTools: Fixed the mis-using strip() function issue. Thread-Index: AQHVP3gXsyBUfZA5fUG+GAiSyECsuqbUeuIAgAFRpeD//61ugIAAjORw Date: Mon, 22 Jul 2019 04:07:19 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D160B45086@SHSMSX105.ccr.corp.intel.com> References: <20190721035452.16704-1-bob.c.feng@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E4ACEA4@SHSMSX104.ccr.corp.intel.com> <08650203BA1BD64D8AD9B6D5D74A85D160B44E43@SHSMSX105.ccr.corp.intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E4AD2A3@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4AD2A3@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks. Pushed. SHA-1: bb824f685d760f560bb3c3fb14af394ab3b3544f Thanks, Bob -----Original Message----- From: Gao, Liming=20 Sent: Monday, July 22, 2019 11:43 AM To: Feng, Bob C ; devel@edk2.groups.io Subject: RE: [edk2-devel] [Patch] BaseTools: Fixed the mis-using strip() f= unction issue. Ok. Make sense.=20 Reviewed-by: Liming Gao > -----Original Message----- > From: Feng, Bob C > Sent: Monday, July 22, 2019 8:48 AM > To: Gao, Liming ; devel@edk2.groups.io > Subject: RE: [edk2-devel] [Patch] BaseTools: Fixed the mis-using strip()= function issue. >=20 > Liming, >=20 > CmdSign[3:] means to get the CmdSign sub string from the 4th character= =20 > to it end. The former code can make sure CmdSign starts with "/Fo", CmdS= ign[3:] is just to remove "/Fo". >=20 > The issue in this case is that the CmdSign is like "/FoF://abc//cde", an= d CmdSign.lstrip("/Fo") removes "/FoF". >=20 > Thanks, > Bob >=20 > -----Original Message----- > From: Gao, Liming > Sent: Sunday, July 21, 2019 8:30 PM > To: devel@edk2.groups.io; Feng, Bob C > Subject: RE: [edk2-devel] [Patch] BaseTools: Fixed the mis-using strip()= function issue. >=20 > Bob: >=20 > > -----Original Message----- > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf=20 > > Of Bob Feng > > Sent: Sunday, July 21, 2019 11:55 AM > > To: devel@edk2.groups.io > > Cc: Gao, Liming ; Feng, Bob C=20 > > > > Subject: [edk2-devel] [Patch] BaseTools: Fixed the mis-using strip() f= unction issue. > > > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2003 > > > > lstrip(parameter) do the match based on the char in parameter but=20 > > not only the whole parameter string. > > > > In GenMake line 1082, > > CmdSign.lstrip('/Fo') will strip the '/' or 'F' or 'o' on the left=20 > > of CmdSign. This is not expected. > > > > This patch is going to fix such issue. > > > > Cc: Liming Gao > > Signed-off-by: Bob Feng > > --- > > BaseTools/Source/Python/AutoGen/GenMake.py | 2 +- > > BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 5 ++++- > > 2 files changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py > > b/BaseTools/Source/Python/AutoGen/GenMake.py > > index 212ca0fa7f..10e67f7dbb 100644 > > --- a/BaseTools/Source/Python/AutoGen/GenMake.py > > +++ b/BaseTools/Source/Python/AutoGen/GenMake.py > > @@ -1077,11 +1077,11 @@ cleanlib: > > CmdTargetDict[CmdSign] =3D Item.replace(Temp,= CmdSign) > > else: > > CmdTargetDict[CmdSign] =3D "%s %s" % (CmdTarg= etDict[CmdSign], SingleCommandList[-1]) > > Index =3D CommandList.index(Item) > > CommandList.pop(Index) > > - if SingleCommandList[-1].endswith("%s%s.c" % (TAB= _SLASH, CmdSumDict[CmdSign.lstrip('/Fo').rsplit(TAB_SLASH, > > 1)[0]])): > > + if SingleCommandList[-1].endswith("%s%s.c" %=20 > > + (TAB_SLASH, CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, > 1)[0]])): >=20 > What mean CmdSign[3:]? Is it for root directory in Windows OS? Does it s= upport the path in Linux OS? >=20 > Thanks > Liming >=20 > > Cpplist =3D CmdCppDict[T.Target.SubDir] > > Cpplist.insert(0, '$(OBJLIST_%d): $(COMMON_DE= PS)' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir)) > > T.Commands[Index] =3D '%s\n\t%s' % (' \\\n\t'= .join(Cpplist), CmdTargetDict[CmdSign]) > > else: > > T.Commands.pop(Index) diff --git=20 > > a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > index c9c476cf61..f43743dff4 100644 > > --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py > > @@ -791,11 +791,14 @@ class GenFdsGlobalVariable: > > # > > @staticmethod > > def GetPcdValue (PcdPattern): > > if PcdPattern is None: > > return None > > - PcdPair =3D PcdPattern.lstrip('PCD(').rstrip(')').strip().spl= it('.') > > + if PcdPattern.startswith('PCD('): > > + PcdPair =3D PcdPattern[4:].rstrip(')').strip().split('.') > > + else: > > + PcdPair =3D PcdPattern.strip().split('.') > > TokenSpace =3D PcdPair[0] > > TokenCName =3D PcdPair[1] > > > > for Arch in GenFdsGlobalVariable.ArchList: > > Platform =3D > > GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.Acti > > ve Platform, Arch, GenFdsGlobalVariable.TargetName,=20 > > GenFdsGlobalVariable.ToolChainTag] > > -- > > 2.18.0.windows.1 > > > > > >=20