From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1487470-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id ED29D15800F
	for <garchives@archives.gentoo.org>; Fri, 17 Feb 2023 01:23:29 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id E7EADE0839;
	Fri, 17 Feb 2023 01:23:28 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C8317E0839
	for <gentoo-commits@lists.gentoo.org>; Fri, 17 Feb 2023 01:23:28 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 9C6D1341141
	for <gentoo-commits@lists.gentoo.org>; Fri, 17 Feb 2023 01:23:27 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D36A18A3
	for <gentoo-commits@lists.gentoo.org>; Fri, 17 Feb 2023 01:23:25 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1676596994.6e1c42a89fe1ae7a5915c6eb8e3e27b47aecf93c.sam@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/
X-VCS-Repository: proj/portage
X-VCS-Files: lib/portage/binpkg.py
X-VCS-Directories: lib/portage/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 6e1c42a89fe1ae7a5915c6eb8e3e27b47aecf93c
X-VCS-Branch: master
Date: Fri, 17 Feb 2023 01:23:25 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: da2ed464-4ed5-41d0-be50-b806cfca7b55
X-Archives-Hash: af3a0184ab81ee8d8d869af714a3bfd6

commit:     6e1c42a89fe1ae7a5915c6eb8e3e27b47aecf93c
Author:     Sheng Yu <syu.os <AT> protonmail <DOT> com>
AuthorDate: Fri Feb 10 07:34:49 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 17 01:23:14 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6e1c42a8

Catch all Exceptions in binpkg identify

We got many different exceptions here, so have to catch all.

Bug: https://bugs.gentoo.org/893638
Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/binpkg.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/portage/binpkg.py b/lib/portage/binpkg.py
index 001a2e277..2078e3ca5 100644
--- a/lib/portage/binpkg.py
+++ b/lib/portage/binpkg.py
@@ -50,8 +50,13 @@ def get_binpkg_format(binpkg_path, check_file=False, remote=False):
             except tarfile.TarError:
                 pass
 
-    except OSError:
+    except Exception as err:
+        # We got many different exceptions here, so have to catch all of them.
         file_format = None
+        writemsg(
+            colorize("ERR", f"Error reading binpkg '{binpkg_path}': {err}"),
+        )
+        raise InvalidBinaryPackageFormat(f"Error reading binpkg '{binpkg_path}': {err}")
 
     if file_format is None:
         raise InvalidBinaryPackageFormat(