From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1Dut5Z-0005CU-4a for garchives@archives.gentoo.org; Tue, 19 Jul 2005 14:28:53 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j6JEQtB7028718; Tue, 19 Jul 2005 14:26:55 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j6JEQsiM032140 for ; Tue, 19 Jul 2005 14:26:55 GMT Received: from p061198163166.ppp.prin.ne.jp ([61.198.163.166] helo=opteron246.suzuki-stubbs.home) by smtp.gentoo.org with esmtpa (Exim 4.43) id 1Dut4Y-00071i-E9 for gentoo-portage-dev@lists.gentoo.org; Tue, 19 Jul 2005 14:27:53 +0000 Received: by opteron246.suzuki-stubbs.home (Postfix, from userid 1000) id 83A2C100A9B; Tue, 19 Jul 2005 23:27:54 +0900 (JST) From: Jason Stubbs To: gentoo-portage-dev@lists.gentoo.org Subject: [gentoo-portage-dev] PATCH: Only use lchown on symlinks (#98827) Date: Tue, 19 Jul 2005 23:27:51 +0900 User-Agent: KMail/1.8.1 References: <200507181213.41595.jstubbs@gentoo.org> In-Reply-To: <200507181213.41595.jstubbs@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1284373.5AqKrseuu2"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200507192327.54222.jstubbs@gentoo.org> X-Archives-Salt: 645f78ed-5d30-443a-8f0e-e1406bfec1b1 X-Archives-Hash: 4fcd7ba73bd215b0fce2aeb32673995c --nextPart1284373.5AqKrseuu2 Content-Type: multipart/mixed; boundary="Boundary-01=_n3Q3CTfB6XlaODL" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_n3Q3CTfB6XlaODL Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Monday 18 July 2005 12:13, Jason Stubbs wrote: > http://bugs.gentoo.org/show_bug.cgi?id=3D98827 >=20 > Making lchown a no-op should fix all these cases without any regressions. Marius pointed out that lchown is currently used on regular files as well as symlinks. This patch separates the usage of os.chown and lchown such that os.chown is only used on non-symlinks and lchown is only used on symlinks. =2D-=20 Jason Stubbs --Boundary-01=_n3Q3CTfB6XlaODL Content-Type: text/x-diff; charset="utf-8"; name="98827_lchown_normal_files.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="98827_lchown_normal_files.patch" --- /usr/lib/portage/pym/portage.py 2005-07-15 23:53:30.843708096 +0900 +++ portage.py 2005-07-19 00:57:43.169904000 +0900 @@ -2866,7 +2866,10 @@ return None # failure try: if didcopy: - lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) + if stat.S_ISLNK(sstat[stat.ST_MODE]): + lchown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) + else + os.chown(dest,sstat[stat.ST_UID],sstat[stat.ST_GID]) os.chmod(dest, stat.S_IMODE(sstat[stat.ST_MODE])) # Sticky is reset on chown os.unlink(src) except SystemExit, e: @@ -6739,7 +6742,7 @@ if bsd_chflags: bsd_chflags.lchflags(mydest, dflags) os.chmod(mydest,mystat[0]) - lchown(mydest,mystat[4],mystat[5]) + os.chown(mydest,mystat[4],mystat[5]) print ">>>",mydest+"/" else: #destination doesn't exist @@ -6751,7 +6754,7 @@ os.chmod(mydest,mystat[0]) if bsd_chflags: bsd_chflags.lchflags(mydest, bsd_chflags.lgetflags(mysrc)) - lchown(mydest,mystat[4],mystat[5]) + os.chown(mydest,mystat[4],mystat[5]) print ">>>",mydest+"/" outfile.write("dir "+myrealdest+"\n") # recurse and merge this directory --Boundary-01=_n3Q3CTfB6XlaODL-- --nextPart1284373.5AqKrseuu2 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBC3Q3qxvWNPsk/ZP4RAuWTAJ9GKFWgVNnpQLt43Dq6nXMKn3sLLwCgmyP9 t5UBtgG4W/g2itL3JAhruCE= =iGbi -----END PGP SIGNATURE----- --nextPart1284373.5AqKrseuu2-- -- gentoo-portage-dev@gentoo.org mailing list