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(
