diff options
author | Mike Frysinger <vapier@chromium.org> | 2021-04-15 21:27:56 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-04-15 21:37:31 -0400 |
commit | 6912679ba7a2fe42f13244dff537fa8338050c2c (patch) | |
tree | 039dba57440cacfba685720a895b2a74bc2c3ebc | |
parent | lddtree: require Python 3.6+ (diff) | |
download | pax-utils-6912679ba7a2fe42f13244dff537fa8338050c2c.tar.gz pax-utils-6912679ba7a2fe42f13244dff537fa8338050c2c.tar.bz2 pax-utils-6912679ba7a2fe42f13244dff537fa8338050c2c.zip |
lddtree: don't crash when interp is missing
Easy way to reproduce is to copy a cross-compile ELF like:
$ ./lddtree.py --copy-to-tree $PWD/foo /usr/share/qemu/s390-ccw.img
lddtree.py: warning: /usr/share/qemu/s390-ccw.img: [Errno 2] No such file or directory: '/lib/ld64.so.1'
We have checks for missing libs already, but interps are full paths
and thus bypass the resolution logic.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rwxr-xr-x | lddtree.py | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -589,8 +589,14 @@ def _ActionCopy(options, elf): os.makedirs(os.path.dirname(dst), exist_ok=True) try: shutil.copy2(realsrc, dst) + except FileNotFoundError as e: + warn(f'{elf["path"]}: {e}') + return except IOError: - os.unlink(dst) + try: + os.unlink(dst) + except FileNotFoundError: + pass shutil.copy2(realsrc, dst) if wrapit: |