From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-838789-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 8957B13888F
	for <garchives@archives.gentoo.org>; Tue,  6 Oct 2015 20:24:15 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 25C0021C02A;
	Tue,  6 Oct 2015 20:24:15 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C1EE721C02A
	for <gentoo-commits@lists.gentoo.org>; Tue,  6 Oct 2015 20:24:14 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id D16A43406AD
	for <gentoo-commits@lists.gentoo.org>; Tue,  6 Oct 2015 20:24:13 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 72808B0C
	for <gentoo-commits@lists.gentoo.org>; Tue,  6 Oct 2015 20:24:11 +0000 (UTC)
From: "Zac Medico" <zmedico@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, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <1444162987.597987aac1677e132b80ed2404697acf0188af7a.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/
X-VCS-Repository: proj/portage
X-VCS-Files: pym/portage/util/__init__.py
X-VCS-Directories: pym/portage/util/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: 597987aac1677e132b80ed2404697acf0188af7a
X-VCS-Branch: master
Date: Tue,  6 Oct 2015 20:24:11 +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-Archives-Salt: 846f12a3-dd31-4e6b-aaed-f8e8369fa538
X-Archives-Hash: 76a1459495baa00f9de398a71a62774c

commit:     597987aac1677e132b80ed2404697acf0188af7a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  6 20:14:54 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct  6 20:23:07 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=597987aa

apply_secpass_permissions: avoid accessing portage.data.secpass when possible

This fixes PermissionDenied errors triggered when portage config files
and repos have restricted access permissions.

Fixes: b7baeeec3ab6 ("unpack: use chmod-lite helper for bug 554084")

 pym/portage/util/__init__.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index 2b7ff8d..b739257 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -1241,7 +1241,9 @@ def apply_secpass_permissions(filename, uid=-1, gid=-1, mode=-1, mask=-1,
 
 	all_applied = True
 
-	if portage.data.secpass < 2:
+	# Avoid accessing portage.data.secpass when possible, since
+	# it triggers config loading (undesirable for chmod-lite).
+	if (uid != -1 or gid != -1) and portage.data.secpass < 2:
 
 		if uid != -1 and \
 		uid != stat_cached.st_uid: