From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1416940-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 BF69D158094
	for <garchives@archives.gentoo.org>; Sun, 10 Jul 2022 16:23:18 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D231AE0D56;
	Sun, 10 Jul 2022 16:23:17 +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 B550BE0D56
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Jul 2022 16:23:17 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(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 7BCDA340FDE
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Jul 2022 16:23:16 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D1AD9391
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Jul 2022 16:23:14 +0000 (UTC)
From: "Brian Dolbec" <dolsen@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, "Brian Dolbec" <dolsen@gentoo.org>
Message-ID: <1657468525.c1c66b84d3e14b887b7b460111664e62238172fb.dolsen@gentoo>
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/equery/
X-VCS-Repository: proj/gentoolkit
X-VCS-Files: pym/gentoolkit/equery/check.py
X-VCS-Directories: pym/gentoolkit/equery/
X-VCS-Committer: dolsen
X-VCS-Committer-Name: Brian Dolbec
X-VCS-Revision: c1c66b84d3e14b887b7b460111664e62238172fb
X-VCS-Branch: master
Date: Sun, 10 Jul 2022 16:23:14 +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: 296ca72c-4736-4a53-999e-ff4f977d54dc
X-Archives-Hash: b9ff43393a1c7ac7e2bbc6023049d7cb

commit:     c1c66b84d3e14b887b7b460111664e62238172fb
Author:     Alexander Miller <alex.miller <AT> gmx <DOT> de>
AuthorDate: Sun Jul 10 15:55:25 2022 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 15:55:25 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=c1c66b84

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 <AT> gentoo.org>

 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())