aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Miller <alex.miller@gmx.de>2022-07-10 08:55:25 -0700
committerBrian Dolbec <dolsen@gentoo.org>2022-07-10 08:55:25 -0700
commitc1c66b84d3e14b887b7b460111664e62238172fb (patch)
tree5c0da6cc136b0fa54d9980f72a3aa2efd14d9f8b
parentpackage.py: code cleanup via black (diff)
downloadgentoolkit-c1c66b84d3e14b887b7b460111664e62238172fb.tar.gz
gentoolkit-c1c66b84d3e14b887b7b460111664e62238172fb.tar.bz2
gentoolkit-c1c66b84d3e14b887b7b460111664e62238172fb.zip
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 <dolsen@gentoo.org>
-rw-r--r--pym/gentoolkit/equery/check.py7
1 files changed, 6 insertions, 1 deletions
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())