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.120, mailfrom: liming.gao@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Sun, 21 Jul 2019 20:42:41 -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 fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jul 2019 20:42:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,293,1559545200"; d="scan'208";a="171512338" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 21 Jul 2019 20:42:40 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 21 Jul 2019 20:42:40 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 21 Jul 2019 20:42:39 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.110]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.109]) with mapi id 14.03.0439.000; Mon, 22 Jul 2019 11:42:38 +0800 From: "Liming Gao" To: "Feng, Bob C" , "devel@edk2.groups.io" 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: AQHVP3gWVmy2ohcCy0u82uK5LeHwzqbVAJ3AgABIcgCAALbyUA== Date: Mon, 22 Jul 2019 03:42:37 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4AD2A3@SHSMSX104.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> In-Reply-To: <08650203BA1BD64D8AD9B6D5D74A85D160B44E43@SHSMSX105.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjI0MjYyNmUtYWFiMi00MjgwLTgxZGUtMDIzNjI3N2U3OGRhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWmZqeWVPSXo1T2JaWHZFSUx1Und2Ylo2N2x4b2pvMEZnUldldmF3ZXpiWUlQdnpSazIxdEowaGFCQ3NlRUs3byJ9 dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 t= o it end. The former code can make sure CmdSign starts with > "/Fo", CmdSign[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 Of > > Bob Feng > > Sent: Sunday, July 21, 2019 11:55 AM > > To: devel@edk2.groups.io > > Cc: Gao, Liming ; Feng, Bob C > > > > 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 not > > only the whole parameter string. > > > > In GenMake line 1082, > > CmdSign.lstrip('/Fo') will strip the '/' or 'F' or 'o' on the left 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" % (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 > > 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.Active > > Platform, Arch, GenFdsGlobalVariable.TargetName, > > GenFdsGlobalVariable.ToolChainTag] > > -- > > 2.18.0.windows.1 > > > > > >=20