Skip to contentSkip to conversation

bb.utils.movefiles: Support cross device move into existing directory

PATCH In review Tobias Hagelborn 1 participant 3 messages Jan 29, 2018 – Jan 31, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bb.utils.movefiles: Support cross device move into existing directory

This was a fully reproducable issue with populate_sdk using a setup of:
* Ubuntu 16 LTS / Linux kernel 4.4
* Docker 17 / storage-driver: overlay2 (overlayfs) (resulting in cross device copy)
* Our firmware image

Tobias Hagelborn (1):
utils.py: Support cross device move into existing directory

 bitbake/lib/bb/utils.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 utils.py: Support cross device move into existing directory

movefile fails copying files cross-device into existing target directory.

Using copy instead of copyfile in this case.

---
 bitbake/lib/bb/utils.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
bitbake/lib/bb/utils.py +2 -3
index c540b49..6769ed6 100644
@@ -791,9 +791,8 @@ def movefile(src, dest, newmtime = None, sstat = None):
     if renamefailed:
         didcopy = 0
         if stat.S_ISREG(sstat[stat.ST_MODE]):
-            try: # For safety copy then move it over.
-                shutil.copyfile(src, destpath + "#new")
-                os.rename(destpath + "#new", destpath)
+            try:
+                shutil.copy(src, dest)
                 didcopy = 1
             except Exception as e:
                 print('movefile: copy', src, '->', dest, 'failed.', e)
Signature · 1 line
2.1.4
#2 lore raw
In reply to Tobias Hagelborn
Quoted 11 lines · Tobias Hagelborn

This was a fully reproducable issue with populate_sdk using a setup of:
* Ubuntu 16 LTS / Linux kernel 4.4
* Docker 17 / storage-driver: overlay2 (overlayfs) (resulting in cross device copy)
* Our firmware image

Tobias Hagelborn (1):
utils.py: Support cross device move into existing directory

  bitbake/lib/bb/utils.py | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

Disregard this one. I missed that is is already fixed.

commit e4dae6320506db320d236c6b45f14f15a7c71c17

Author: Mardegan, Alberto <[email protected]>
Date:   Thu Sep 21 14:33:52 2017 +0000

//Tobias