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 CCC4E1389E2 for ; Sat, 6 Dec 2014 00:04:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 06190E088A; Sat, 6 Dec 2014 00:03:55 +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 5330DE0883 for ; Sat, 6 Dec 2014 00:03:54 +0000 (UTC) Received: from pomiot.lan (77-253-129-159.adsl.inetia.pl [77.253.129.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id C0D9C3405F8; Sat, 6 Dec 2014 00:03:52 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH 3/4] sync: ensure sync_{umask,user} is respected when creating repo Date: Sat, 6 Dec 2014 01:03:35 +0100 Message-Id: <1417824216-7990-4-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.2.0 In-Reply-To: <1417824216-7990-1-git-send-email-mgorny@gentoo.org> References: <1417824216-7990-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: ab5c980d-3e94-4ad8-8a59-ae1b523a58c2 X-Archives-Hash: b05534fab5a6b3f72c1c6714e7543e80 --- 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 3104524..4fa1e5a 100644 --- a/pym/portage/sync/controller.py +++ b/pym/portage/sync/controller.py @@ -185,11 +185,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 = {} @@ -243,7 +238,24 @@ class SyncManager(object): spawn_kwargs["gid"] = gid spawn_kwargs["groups"] = [gid] 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)): -- 2.2.0