From bb824f685d760f560bb3c3fb14af394ab3b3544f Mon Sep 17 00:00:00 2001 From: "Feng, Bob C" Date: Sun, 21 Jul 2019 11:31:11 +0800 Subject: [PATCH] BaseTools: Fixed the mis-using strip() function issue. 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 Reviewed-by: Liming Gao --- 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 @@ -1079,7 +1079,7 @@ cleanlib: 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]) 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 @@ -793,7 +793,10 @@ class GenFdsGlobalVariable: 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] -- 2.39.2