[edk2-devel] [Patch V2] BaseTools/Ecc: Fix an issue of path separator compatibility

Bob Feng bob.c.feng at intel.com
Tue Sep 1 10:23:15 UTC 2020


REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2904

The path separator is different in Windows and Linux, the
original code does not handle this difference. This patch
is to fix this issue.

Signed-off-by: Bob Feng <bob.c.feng at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen at intel.com>
Cc: Shenglei Zhang <shenglei.zhang at intel.com>
---
V2
Change to a better method to get path separator.

 BaseTools/Source/Python/Ecc/Check.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py
index 0fdc7e35c1..6087abfa4d 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1101,15 +1101,15 @@ class Check(object):
             for Item in InfPathSet:
                 if Item[0] not in InfPathList:
                     InfPathList.append(Item[0])
             SqlCommand = """
                          select ID, Path, FullPath from File where upper(FullPath) not in
-                            (select upper(A.Path) || '\\' || upper(B.Value1) from File as A, INF as B
+                            (select upper(A.Path) || '%s' || upper(B.Value1) from File as A, INF as B
                             where A.ID in (select BelongsToFile from INF where Model = %s group by BelongsToFile) and
                             B.BelongsToFile = A.ID and B.Model = %s)
                             and (Model = %s or Model = %s)
-                        """ % (MODEL_EFI_SOURCE_FILE, MODEL_EFI_SOURCE_FILE, MODEL_FILE_C, MODEL_FILE_H)
+                        """ % (os.sep, MODEL_EFI_SOURCE_FILE, MODEL_EFI_SOURCE_FILE, MODEL_FILE_C, MODEL_FILE_H)
             RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
             for Record in RecordSet:
                 Path = Record[1]
                 Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
                 if Path in InfPathList:
@@ -1130,13 +1130,13 @@ class Check(object):
                 if Pcd[3]:
                     PcdName = Pcd[3]
                 BelongsToFile = Pcd[4]
                 SqlCommand = """
                              select ID from File where FullPath in
-                            (select B.Path || '\\' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
+                            (select B.Path || '%s' || A.Value1 from INF as A, File as B where A.Model = %s and A.BelongsToFile = %s
                              and B.ID = %s and (B.Model = %s or B.Model = %s))
-                             """ % (MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
+                             """ % (os.sep, MODEL_EFI_SOURCE_FILE, BelongsToFile, BelongsToFile, MODEL_FILE_C, MODEL_FILE_H)
                 TableSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
                 for Tbl in TableSet:
                     TblName = 'Identifier' + str(Tbl[0])
                     SqlCommand = """
                                  select Name, ID from %s where value like '%s' and Model = %s
-- 
2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#64887): https://edk2.groups.io/g/devel/message/64887
Mute This Topic: https://groups.io/mt/76553178/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list