[elbe-devel] [PATCH 5/8] efilesystem: fix copy_filelist symlink to non existant directory copy

Torben Hohn torben.hohn at linutronix.de
Wed Mar 4 13:08:08 CET 2020


The example armel-rescue-busybox-cpio.xml triggers this bug:

----------------------------------------------------------------------------------------
[ERROR] Build failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/elbepack/asyncworker.py", line 186, in execute
    skip_pbuild=self.skip_pbuilder)
  File "/usr/lib/python2.7/dist-packages/elbepack/elbeproject.py", line 551, in build
    self.get_rpcaptcache())
  File "/usr/lib/python2.7/dist-packages/elbepack/efilesystem.py", line 83, in extract_target
    copy_filelist(src, file_list, dst)
  File "/usr/lib/python2.7/dist-packages/elbepack/efilesystem.py", line 40, in copy_filelist
    dst.fname(f)))
  File "/usr/lib/python2.7/dist-packages/elbepack/shellhelper.py", line 39, in system
    raise CommandError(cmd, ret)
CommandError: Error: 1 returned from Command cp -a --reflink=auto "/var/cache/elbe/d6bda8a8-fd79-4eba-a443-98ea0a8fefcb/chroot/bin/busybox" "/var/cache/elbe/d6bda8a8-fd79-4eba-a443-98ea0a8fefcb/target/bin/busybox"
Project build was not successful, current status: build_failed
elbe control wait_busy Failed
----------------------------------------------------------------------------------------

this is caused by /bin being a symlink to /usr bin.
The /bin symlink has already been copied at that point.
but /usr/bin has not.

Fix that by making sure, that the target directory of a symlink exists,
when its copied.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/efilesystem.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 5bc20afda..55dda7bf2 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -36,6 +36,10 @@ def copy_filelist(src, filelist, dst):
             st = src.stat(f)
             dst.chown(f, st.st_uid, st.st_gid)
         else:
+            if src.isdir(f) and src.islink(f):
+                tgt = src.readlink(f)
+                if not dst.isdir(tgt):
+                    dst.mkdir(tgt)
             system('cp -a --reflink=auto "%s" "%s"' % (src.fname(f),
                                                        dst.fname(f)))
     # update utime which will change after a file has been copied into
-- 
2.20.1




More information about the elbe-devel mailing list