1 |
commit: 6912679ba7a2fe42f13244dff537fa8338050c2c |
2 |
Author: Mike Frysinger <vapier <AT> chromium <DOT> org> |
3 |
AuthorDate: Fri Apr 16 01:27:56 2021 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 16 01:37:31 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=6912679b |
7 |
|
8 |
lddtree: don't crash when interp is missing |
9 |
|
10 |
Easy way to reproduce is to copy a cross-compile ELF like: |
11 |
$ ./lddtree.py --copy-to-tree $PWD/foo /usr/share/qemu/s390-ccw.img |
12 |
lddtree.py: warning: /usr/share/qemu/s390-ccw.img: [Errno 2] No such file or directory: '/lib/ld64.so.1' |
13 |
|
14 |
We have checks for missing libs already, but interps are full paths |
15 |
and thus bypass the resolution logic. |
16 |
|
17 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
18 |
|
19 |
lddtree.py | 8 +++++++- |
20 |
1 file changed, 7 insertions(+), 1 deletion(-) |
21 |
|
22 |
diff --git a/lddtree.py b/lddtree.py |
23 |
index b65c3f2..e3dafda 100755 |
24 |
--- a/lddtree.py |
25 |
+++ b/lddtree.py |
26 |
@@ -589,8 +589,14 @@ def _ActionCopy(options, elf): |
27 |
os.makedirs(os.path.dirname(dst), exist_ok=True) |
28 |
try: |
29 |
shutil.copy2(realsrc, dst) |
30 |
+ except FileNotFoundError as e: |
31 |
+ warn(f'{elf["path"]}: {e}') |
32 |
+ return |
33 |
except IOError: |
34 |
- os.unlink(dst) |
35 |
+ try: |
36 |
+ os.unlink(dst) |
37 |
+ except FileNotFoundError: |
38 |
+ pass |
39 |
shutil.copy2(realsrc, dst) |
40 |
|
41 |
if wrapit: |