[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 04/15] tests/docker: preserve original name when copying libs
From: |
Alex Bennée |
Subject: |
[PATCH v1 04/15] tests/docker: preserve original name when copying libs |
Date: |
Tue, 2 Feb 2021 13:39:49 +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>
---
tests/docker/docker.py | 7 ++++---
1 file 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):
--
2.20.1
- [PATCH v1 00/15] testing/gdbstub/docs pre-PR, Alex Bennée, 2021/02/02
- [PATCH v1 02/15] tests/docker: Fix typo in help message, Alex Bennée, 2021/02/02
- [PATCH v1 01/15] tests/docker: Fix _get_so_libs() for docker-binfmt-image, Alex Bennée, 2021/02/02
- [PATCH v1 04/15] tests/docker: preserve original name when copying libs,
Alex Bennée <=
- [PATCH v1 03/15] tests/docker: make _copy_with_mkdir accept missing files, Alex Bennée, 2021/02/02
- [PATCH v1 05/15] tests/docker: alias docker-help target for consistency, Alex Bennée, 2021/02/02
- [PATCH v1 06/15] tests/docker: add a docker-exec-copy-test, Alex Bennée, 2021/02/02
- [PATCH v1 08/15] configure: bump the minimum gdb version for check-tcg to 9.1, Alex Bennée, 2021/02/02
- [PATCH v1 09/15] tests/tcg: don't silently skip the gdb tests, Alex Bennée, 2021/02/02
- [PATCH v1 07/15] configure: make version_ge more tolerant of shady version input, Alex Bennée, 2021/02/02
- [PATCH v1 11/15] tests/tcg: Replace /bin/true by true (required on macOS), Alex Bennée, 2021/02/02