summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2021-02-02 13:39:49 +0000
committerAlex Bennée <alex.bennee@linaro.org>2021-02-08 09:41:00 +0000
commit3971c70f159e00fa0a311b0a39c3baa1f2d814f4 (patch)
treeec119ed733f92f44e2aeecc1db288bbb3af1ba87
parentdffccf3d34467d7280212445e521f458d31ac6a2 (diff)
downloadfocaccia-qemu-3971c70f159e00fa0a311b0a39c3baa1f2d814f4.tar.gz
focaccia-qemu-3971c70f159e00fa0a311b0a39c3baa1f2d814f4.zip
tests/docker: preserve original name when copying libs
While it is important we chase down the symlinks to copy the correct
data we can confuse the kernel by renaming the interpreter to what is
in the binary. Extend _copy_with_mkdir to preserve the original name
of the file when asked.

Fixes: 5e33f7fead ("tests/docker: better handle symlinked libs")
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210202134001.25738-5-alex.bennee@linaro.org>
-rwxr-xr-xtests/docker/docker.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index fb3de41c0b..39da3fefcf 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -93,7 +93,7 @@ def _guess_engine_command():
                     commands_txt)
 
 
-def _copy_with_mkdir(src, root_dir, sub_path='.'):
+def _copy_with_mkdir(src, root_dir, sub_path='.', name=None):
     """Copy src into root_dir, creating sub_path as needed."""
     dest_dir = os.path.normpath("%s/%s" % (root_dir, sub_path))
     try:
@@ -102,7 +102,7 @@ def _copy_with_mkdir(src, root_dir, sub_path='.'):
         # we can safely ignore already created directories
         pass
 
-    dest_file = "%s/%s" % (dest_dir, os.path.basename(src))
+    dest_file = "%s/%s" % (dest_dir, name if name else os.path.basename(src))
 
     try:
         copy(src, dest_file)
@@ -155,8 +155,9 @@ def _copy_binary_with_libs(src, bin_dest, dest_dir):
     if libs:
         for l in libs:
             so_path = os.path.dirname(l)
+            name = os.path.basename(l)
             real_l = os.path.realpath(l)
-            _copy_with_mkdir(real_l, dest_dir, so_path)
+            _copy_with_mkdir(real_l, dest_dir, so_path, name)
 
 
 def _check_binfmt_misc(executable):