From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: bob.c.feng@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Sun, 21 Jul 2019 17:47:40 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jul 2019 17:47:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,292,1559545200"; d="scan'208";a="252742722" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga001.jf.intel.com with ESMTP; 21 Jul 2019 17:47:40 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 21 Jul 2019 17:47:39 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 21 Jul 2019 17:47:38 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.232]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.174]) with mapi id 14.03.0439.000; Mon, 22 Jul 2019 08:47:37 +0800 From: "Bob Feng" To: "Gao, Liming" , "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: AQHVP3gXsyBUfZA5fUG+GAiSyECsuqbUeuIAgAFRpeA= Date: Mon, 22 Jul 2019 00:47:36 +0000 Message-ID: <08650203BA1BD64D8AD9B6D5D74A85D160B44E43@SHSMSX105.ccr.corp.intel.com> References: <20190721035452.16704-1-bob.c.feng@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E4ACEA4@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4ACEA4@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 Liming, CmdSign[3:] means to get the CmdSign sub string from the 4th character to = it end. The former code can make sure CmdSign starts with "/Fo", CmdSign[3:= ] is just to remove "/Fo". The issue in this case is that the CmdSign is like "/FoF://abc//cde", and = CmdSign.lstrip("/Fo") removes "/FoF".=20 Thanks, Bob -----Original Message----- From: Gao, Liming=20 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() f= unction issue. Bob: > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of=20 > 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() fun= ction issue. >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2003 >=20 > lstrip(parameter) do the match based on the char in parameter but not=20 > only the whole parameter string. >=20 > In GenMake line 1082, > CmdSign.lstrip('/Fo') will strip the '/' or 'F' or 'o' on the left of=20 > CmdSign. This is not expected. >=20 > This patch is going to fix such issue. >=20 > 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(-) >=20 > diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py=20 > 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, C= mdSign) > else: > CmdTargetDict[CmdSign] =3D "%s %s" % (CmdTarget= Dict[CmdSign], SingleCommandList[-1]) > Index =3D CommandList.index(Item) > CommandList.pop(Index) > - if SingleCommandList[-1].endswith("%s%s.c" % (TAB_S= LASH, CmdSumDict[CmdSign.lstrip('/Fo').rsplit(TAB_SLASH, > 1)[0]])): > + if SingleCommandList[-1].endswith("%s%s.c" % (TAB_S= LASH, CmdSumDict[CmdSign[3:].rsplit(TAB_SLASH, 1)[0]])): What mean CmdSign[3:]? Is it for root directory in Windows OS? Does it sup= port the path in Linux OS? Thanks Liming > Cpplist =3D CmdCppDict[T.Target.SubDir] > Cpplist.insert(0, '$(OBJLIST_%d): $(COMMON_DEPS= )' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir)) > T.Commands[Index] =3D '%s\n\t%s' % (' \\\n\t'.j= oin(Cpplist), CmdTargetDict[CmdSign]) > else: > T.Commands.pop(Index) diff --git=20 > a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py=20 > 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().split= ('.') > + 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] >=20 > for Arch in GenFdsGlobalVariable.ArchList: > Platform =3D=20 > GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.Active > Platform, Arch, GenFdsGlobalVariable.TargetName,=20 > GenFdsGlobalVariable.ToolChainTag] > -- > 2.18.0.windows.1 >=20 >=20 >=20