* [PATCH] BaseTools: Add more parameter checking for CopyFileOnChange()
@ 2019-09-16 2:51 Steven Shi
0 siblings, 0 replies; only message in thread
From: Steven Shi @ 2019-09-16 2:51 UTC (permalink / raw)
To: devel; +Cc: liming.gao, bob.c.feng
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2193
The current CopyFileOnChange() method in Misc.py does not
accept the input SrcFile parameter as a dir, but the method
does not check the SrcFile is dir or not. This patch is to
add more input parameter type checking and error message output
for method CopyFileOnChange.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Steven Shi <steven.shi@intel.com>
---
BaseTools/Source/Python/Common/Misc.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index 15ae6a9e40..7c93fc4dca 100755
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -541,6 +541,11 @@ def CopyFileOnChange(SrcFile, Dst, FileLock=None):
Dst = LongFilePath(Dst)
if not os.path.exists(SrcFile):
+ EdkLogger.error(None, FILE_COPY_FAILURE, ExtraData='CopyFileOnChange SrcFile does not exists: %s' % SrcFile)
+ return False
+
+ if os.path.isdir(SrcFile):
+ EdkLogger.error(None, FILE_COPY_FAILURE, ExtraData='CopyFileOnChange SrcFile is a dir, not a file: %s' % SrcFile)
return False
if os.path.isdir(Dst):
--
2.17.1.windows.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-09-16 2:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-16 2:51 [PATCH] BaseTools: Add more parameter checking for CopyFileOnChange() Steven Shi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox