diff options
author | zhijufan <zhijux.fan@intel.com> | 2018-10-17 08:57:01 +0300 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-11-01 05:27:13 +0300 |
commit | d3d97b378fe4d0bfbcbdb296d06bcf1d09165480 (patch) | |
tree | af7e1c1944a760e37f91425dd59303f46c2ee6f4 /BaseTools/Source/Python/Common/Misc.py | |
parent | 5b9639e697350c9e18e98ddb0119e8598b004a8f (diff) | |
download | edk2-d3d97b378fe4d0bfbcbdb296d06bcf1d09165480.tar.xz |
BaseTools: Add special handle for '\' use in Pcd Value
V2: Follow PEP8 to not multiples import on one line
Case:
gEfiOzmosisPkgTokenSpaceGuid.PcdBootLogFolderPath|L"\\Logs\\"|VOID*|12
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1287
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/Common/Misc.py')
-rw-r--r-- | BaseTools/Source/Python/Common/Misc.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index b32b7cdc5f..3b8efb2e71 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -24,6 +24,7 @@ import re import pickle
import array
import shutil
+from random import sample
from struct import pack
from UserDict import IterableUserDict
from UserList import UserList
@@ -1236,7 +1237,8 @@ def IsFieldValueAnArray (Value): return False
def AnalyzePcdExpression(Setting):
- Setting = Setting.strip()
+ RanStr = ''.join(sample(string.ascii_letters + string.digits, 8))
+ Setting = Setting.replace('\\\\', RanStr).strip()
# There might be escaped quote in a string: \", \\\" , \', \\\'
Data = Setting
# There might be '|' in string and in ( ... | ... ), replace it with '-'
@@ -1269,7 +1271,9 @@ def AnalyzePcdExpression(Setting): break
FieldList.append(Setting[StartPos:Pos].strip())
StartPos = Pos + 1
-
+ for i, ch in enumerate(FieldList):
+ if RanStr in ch:
+ FieldList[i] = ch.replace(RanStr,'\\\\')
return FieldList
def ParseDevPathValue (Value):
|