From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EA2E1138334 for ; Thu, 3 Jan 2019 07:11:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C43A9E0A93; Thu, 3 Jan 2019 07:11:20 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9706DE0A93 for ; Thu, 3 Jan 2019 07:11:18 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 07E41335CFD for ; Thu, 3 Jan 2019 07:11:16 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D0DDD42F for ; Thu, 3 Jan 2019 07:11:13 +0000 (UTC) From: "Zac Medico" 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" Message-ID: <1546496502.8ddc902ba8cb4712a2a8b49f46951c8ec326a678.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/rsync/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/sync/modules/rsync/rsync.py X-VCS-Directories: lib/portage/sync/modules/rsync/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 8ddc902ba8cb4712a2a8b49f46951c8ec326a678 X-VCS-Branch: master Date: Thu, 3 Jan 2019 07:11:13 +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-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 0a48d5f2-2aa3-4c8b-af1d-cf32e9d60d6a X-Archives-Hash: dcf76dfaffd2b5b0cc60ca9d2d24f848 commit: 8ddc902ba8cb4712a2a8b49f46951c8ec326a678 Author: Zac Medico gentoo org> AuthorDate: Thu Jan 3 02:48:32 2019 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu Jan 3 06:21:42 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8ddc902b rsync: use ${PORTAGE_TMPDIR}/portage (bug 671808) Write temporary timestamp files in ${PORTAGE_TMPDIR}/portage, since writing files directly in ${PORTAGE_TMPDIR} is generally unexpected. Also, use the rsync --inplace option, since it's writing to a temp file created in advance and the usersync user does not necessarily have write access to the parent directory. Bug: https://bugs.gentoo.org/671808 Bug: https://bugs.gentoo.org/336503 Fixes: 3f7f72cf339d ("Bug #336503 - Use PORTAGE_TMPDIR for the emerge --sync server timestamp") Signed-off-by: Zac Medico gentoo.org> lib/portage/sync/modules/rsync/rsync.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py index 0f8221776..e6f2688f8 100644 --- a/lib/portage/sync/modules/rsync/rsync.py +++ b/lib/portage/sync/modules/rsync/rsync.py @@ -583,11 +583,17 @@ class RsyncSync(NewBase): # Temporary file for remote server timestamp comparison. # NOTE: If FEATURES=usersync is enabled then the tempfile # needs to be in a directory that's readable by the usersync - # user. We assume that PORTAGE_TMPDIR will satisfy this + # user. We assume that ${PORTAGE_TMPDIR}/portage will satisfy this # requirement, since that's not necessarily true for the # default directory used by the tempfile module. if self.usersync_uid is not None: - tmpdir = self.settings['PORTAGE_TMPDIR'] + tmpdir = os.path.join(self.settings['PORTAGE_TMPDIR'], 'portage') + ensure_dirs_kwargs = {} + if portage.secpass >= 1: + ensure_dirs_kwargs['gid'] = portage.portage_gid + ensure_dirs_kwargs['mode'] = 0o70 + ensure_dirs_kwargs['mask'] = 0 + portage.util.ensure_dirs(tmpdir, **ensure_dirs_kwargs) else: # use default dir from tempfile module tmpdir = None @@ -598,6 +604,7 @@ class RsyncSync(NewBase): portage.util.apply_permissions(tmpservertimestampfile, uid=self.usersync_uid) command = rsynccommand[:] + command.append('--inplace') command.append(syncuri.rstrip("/") + \ "/metadata/timestamp.chk") command.append(tmpservertimestampfile)