From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 35278138ACE for ; Sun, 7 Dec 2014 22:57:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5D471E0A40; Sun, 7 Dec 2014 22:57:20 +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 CFD40E0A8A for ; Sun, 7 Dec 2014 22:57:19 +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 C1E1D340504 for ; Sun, 7 Dec 2014 22:57:18 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 27A3EBD52 for ; Sun, 7 Dec 2014 22:57:17 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1417993027.9a2b1e6096e35508e9f101fa0478101493ef0335.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/sync/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/controller.py X-VCS-Directories: pym/portage/sync/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 9a2b1e6096e35508e9f101fa0478101493ef0335 X-VCS-Branch: master Date: Sun, 7 Dec 2014 22:57:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: fb25602b-8210-464d-931d-1835efc1225c X-Archives-Hash: a3b0e657e1404c56de3a68bc8fae2910 commit: 9a2b1e6096e35508e9f101fa0478101493ef0335 Author: Michał Górny gentoo org> AuthorDate: Fri Dec 5 22:54:27 2014 +0000 Commit: Michał Górny gentoo org> CommitDate: Sun Dec 7 22:57:07 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9a2b1e60 sync: ensure sync_{umask,user} is respected when creating repo --- pym/portage/sync/controller.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py index ab6eb21..9001298 100644 --- a/pym/portage/sync/controller.py +++ b/pym/portage/sync/controller.py @@ -192,11 +192,6 @@ class SyncManager(object): st = os.stat(repo.location) except OSError: st = None - if st is None: - writemsg_level(">>> '%s' not found, creating it." - % _unicode_decode(repo.location)) - portage.util.ensure_dirs(repo.location, mode=0o755) - st = os.stat(repo.location) self.usersync_uid = None spawn_kwargs = {} @@ -249,7 +244,24 @@ class SyncManager(object): spawn_kwargs["groups"] = [gid] if home is not None: spawn_kwargs["env"]["HOME"] = home - elif ('usersync' in self.settings.features and + + if st is None: + perms = {'mode': 0o755} + # respect sync-user if set + if 'umask' in spawn_kwargs: + perms['mode'] &= ~spawn_kwargs['umask'] + if 'uid' in spawn_kwargs: + perms['uid'] = spawn_kwargs['uid'] + if 'gid' in spawn_kwargs: + perms['gid'] = spawn_kwargs['gid'] + + writemsg_level(">>> '%s' not found, creating it." + % _unicode_decode(repo.location)) + portage.util.ensure_dirs(repo.location, **perms) + st = os.stat(repo.location) + + if (repo.sync_user is None and + 'usersync' in self.settings.features and portage.data.secpass >= 2 and (st.st_uid != os.getuid() and st.st_mode & 0o700 or st.st_gid != os.getgid() and st.st_mode & 0o070)):