From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id ED9C31382C5 for ; Fri, 16 Apr 2021 01:56:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 30DD8E077C; Fri, 16 Apr 2021 01:56:33 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 18694E077C for ; Fri, 16 Apr 2021 01:56:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A8FAE335C86 for ; Fri, 16 Apr 2021 01:56:31 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1882D64C for ; Fri, 16 Apr 2021 01:56:30 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1618537051.6912679ba7a2fe42f13244dff537fa8338050c2c.vapier@gentoo> Subject: [gentoo-commits] proj/pax-utils:master commit in: / X-VCS-Repository: proj/pax-utils X-VCS-Files: lddtree.py X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 6912679ba7a2fe42f13244dff537fa8338050c2c X-VCS-Branch: master Date: Fri, 16 Apr 2021 01:56:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 887fb497-9489-4cff-98bb-0e38607641c4 X-Archives-Hash: 1fe7fafaba64479f17df642f26df810f commit: 6912679ba7a2fe42f13244dff537fa8338050c2c Author: Mike Frysinger chromium org> AuthorDate: Fri Apr 16 01:27:56 2021 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri Apr 16 01:37:31 2021 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=6912679b 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 gentoo.org> lddtree.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lddtree.py b/lddtree.py index b65c3f2..e3dafda 100755 --- a/lddtree.py +++ b/lddtree.py @@ -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: