From c1c66b84d3e14b887b7b460111664e62238172fb Mon Sep 17 00:00:00 2001 From: Alexander Miller Date: Sun, 10 Jul 2022 08:55:25 -0700 Subject: equery check: Fix exception handling for Insufficient permissions A quick look into the source reveals that there is actually code to handle the case, but it expects the wrong exception type. This patch fixes that and also avoids a crash for other errors. Bug: https://bugs.gentoo.org/494134 Signed-off-by: Brian Dolbec --- pym/gentoolkit/equery/check.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pym/gentoolkit/equery/check.py b/pym/gentoolkit/equery/check.py index 7a7c3db..7e580b1 100644 --- a/pym/gentoolkit/equery/check.py +++ b/pym/gentoolkit/equery/check.py @@ -16,6 +16,7 @@ from functools import partial from getopt import gnu_getopt, GetoptError import portage.checksum as checksum +from portage.exception import PermissionDenied import gentoolkit.pprinter as pp from gentoolkit import errors @@ -138,10 +139,14 @@ class VerifyContents: md5sum = files[cfile][2] try: cur_checksum = checksum.perform_md5(real_cfile, calc_prelink=1) - except IOError: + except PermissionDenied: err = "Insufficient permissions to read %(cfile)s" obj_errs.append(err % locals()) return obj_errs + except Exception as ex: + err = "Problem checking %(cfile)s: %(ex)s" + obj_errs.append(err % locals()) + return obj_errs if cur_checksum != md5sum: err = "%(cfile)s has incorrect MD5sum" obj_errs.append(err % locals()) -- cgit v1.2.3