From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Raks0-0006lr-Tc for garchives@archives.gentoo.org; Wed, 14 Dec 2011 09:11:25 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 54A7221C217; Wed, 14 Dec 2011 09:11:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1958221C217 for ; Wed, 14 Dec 2011 09:11:16 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8B85E1B401D for ; Wed, 14 Dec 2011 09:11:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D42D68004A for ; Wed, 14 Dec 2011 09:11:14 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <2dbb9bb3bdb826a7da41ba1ccd89f4f8c8ee529c.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/locks.py X-VCS-Directories: pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 2dbb9bb3bdb826a7da41ba1ccd89f4f8c8ee529c Date: Wed, 14 Dec 2011 09:11:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: eec2e97c-2fb5-4c3f-9b59-dbee34626641 X-Archives-Hash: d43f710470da72724bd5d71ca5300854 commit: 2dbb9bb3bdb826a7da41ba1ccd89f4f8c8ee529c Author: Zac Medico gentoo org> AuthorDate: Wed Dec 14 09:11:07 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Dec 14 09:11:07 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D2dbb9bb3 hardlink_lockfile: preserve existing permissions --- pym/portage/locks.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pym/portage/locks.py b/pym/portage/locks.py index 297609c..a645e25 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -316,6 +316,7 @@ def hardlink_lockfile(lockfilename, max_wait=3DDeprec= ationWarning, global _quiet out =3D None displayed_waiting_msg =3D False + preexisting =3D os.path.exists(lockfilename) myhardlock =3D hardlock_name(lockfilename) =20 # myhardlock must not exist prior to our link() call, and we can @@ -350,8 +351,11 @@ def hardlink_lockfile(lockfilename, max_wait=3DDepre= cationWarning, myfd_st =3D None try: myfd_st =3D os.fstat(myfd) - if myfd_st.st_gid !=3D portage_gid: - os.fchown(myfd, -1, portage_gid) + if not preexisting: + # Don't chown the file if it is preexisting, since we + # want to preserve existing permissions in that case. + if myfd_st.st_gid !=3D portage_gid: + os.fchown(myfd, -1, portage_gid) except OSError as e: if e.errno not in (errno.ENOENT, errno.ESTALE): writemsg("%s: fchown('%s', -1, %d)\n" % \