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.43, mailfrom: bob.c.feng@intel.com) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by groups.io with SMTP; Sat, 20 Jul 2019 20:55:01 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jul 2019 20:55:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,289,1559545200"; d="scan'208";a="320353478" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga004.jf.intel.com with ESMTP; 20 Jul 2019 20:54:59 -0700 From: "Bob Feng" To: devel@edk2.groups.io Cc: Liming Gao , Bob Feng Subject: [Patch] BaseTools: Fixed the mis-using strip() function issue. Date: Sun, 21 Jul 2019 11:54:52 +0800 Message-Id: <20190721035452.16704-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2003 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] = Item.replace(Temp, CmdSign) else: CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1]) Index = 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]])): Cpplist = CmdCppDict[T.Target.SubDir] Cpplist.insert(0, '$(OBJLIST_%d): $(COMMON_DEPS)' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir)) T.Commands[Index] = '%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 = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.') + if PcdPattern.startswith('PCD('): + PcdPair = PcdPattern[4:].rstrip(')').strip().split('.') + else: + PcdPair = PcdPattern.strip().split('.') TokenSpace = PcdPair[0] TokenCName = PcdPair[1] for Arch in GenFdsGlobalVariable.ArchList: Platform = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] -- 2.18.0.windows.1