[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/16] tests/docker: preserve original name when copying libs
From: |
Alex Bennée |
Subject: |
[PULL 05/16] tests/docker: preserve original name when copying libs |
Date: |
Mon, 8 Feb 2021 12:38:10 +0000 |
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>
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):
--
2.20.1
- [PULL 00/16] testing, gdbstub and doc tweaks, Alex Bennée, 2021/02/08
- [PULL 02/16] tests/docker: Fix _get_so_libs() for docker-binfmt-image, Alex Bennée, 2021/02/08
- [PULL 05/16] tests/docker: preserve original name when copying libs,
Alex Bennée <=
- [PULL 11/16] gdbstub: Fix handle_query_xfer_auxv, Alex Bennée, 2021/02/08
- [PULL 04/16] tests/docker: make _copy_with_mkdir accept missing files, Alex Bennée, 2021/02/08
- [PULL 08/16] configure: make version_ge more tolerant of shady version input, Alex Bennée, 2021/02/08
- [PULL 03/16] tests/docker: Fix typo in help message, Alex Bennée, 2021/02/08
- [PULL 12/16] tests/tcg: Replace /bin/true by true (required on macOS), Alex Bennée, 2021/02/08
- [PULL 07/16] tests/docker: add a docker-exec-copy-test, Alex Bennée, 2021/02/08
- [PULL 06/16] tests/docker: alias docker-help target for consistency, Alex Bennée, 2021/02/08
- [PULL 13/16] scripts/mtest2make.py: export all-%s-targets variable and use it, Alex Bennée, 2021/02/08
- [PULL 01/16] tests/acceptance: Increase the timeout in the replay tests, Alex Bennée, 2021/02/08
- [PULL 10/16] tests/tcg: don't silently skip the gdb tests, Alex Bennée, 2021/02/08