[poky] [PATCH 3/8] yocto-bsp: have replace_file() close file before copying

tom.zanussi at linux.intel.com tom.zanussi at linux.intel.com
Thu Apr 4 15:09:18 PDT 2013


From: Tom Zanussi <tom.zanussi at linux.intel.com>

replace_file needs to make sure the file it's replacing is closed
before replacing it, otherwise unexpected results may ensue.

Fixes [YOCTO #4145].

Signed-off-by: Tom Zanussi <tom.zanussi at linux.intel.com>
---
 scripts/lib/bsp/engine.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py
index 86cb51c..36bd446 100644
--- a/scripts/lib/bsp/engine.py
+++ b/scripts/lib/bsp/engine.py
@@ -571,7 +571,8 @@ def replace_file(replace_this, with_this):
     the original filename.
     """
     try:
-        shutil.copy(with_this, replace_this)
+        replace_this.close()
+        shutil.copy(with_this, replace_this.name)
     except IOError:
         pass
 
-- 
1.7.11.4




More information about the poky mailing list