public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] PATCH: Make lchown a no-op rather than aliasing to chown on Darwin (#98827)
@ 2005-07-18  3:13 Jason Stubbs
  2005-07-19 14:27 ` [gentoo-portage-dev] PATCH: Only use lchown on symlinks (#98827) Jason Stubbs
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Stubbs @ 2005-07-18  3:13 UTC (permalink / raw
  To: gentoo-portage-dev


[-- Attachment #1.1: Type: text/plain, Size: 595 bytes --]

http://bugs.gentoo.org/show_bug.cgi?id=98827

Author: Jason Stubbs

Portage presently alters permissions of the target of a symlink rather 
than the symlink itself on Darwin. As well as the possibility that 
the target's permissions are modified incorrectly, there is also the 
case that the symlink points somewhere on the live filesystem or 
doesn't point anywhere at all. The former case will is definately 
incorrect and the latter case will cause portage to fail with a 
traceback. Making lchown a no-op should fix all these cases without 
any regressions.

-- 
Jason Stubbs

[-- Attachment #1.2: 98827_darwin_noop_lchown.patch --]
[-- Type: text/x-diff, Size: 550 bytes --]

diff -uNr portage-stable/pym/portage_data.py portage-fixed/pym/portage_data.py
--- portage-stable/pym/portage_data.py	2005-05-15 19:20:58.000000000 +0900
+++ portage-fixed/pym/portage_data.py	2005-07-18 11:27:09.096800056 +0900
@@ -16,8 +16,9 @@
 	os.environ["XARGS"]="xargs -r"
 elif ostype == "Darwin":
 	userland="Darwin"
-	os.environ["XARGS"]="xargs"	
-	lchown=os.chown
+	os.environ["XARGS"]="xargs"
+	def lchown(*pos_args, **key_args):
+		pass
 elif ostype in ["FreeBSD","OpenBSD"]:
 	userland="BSD"
 	os.environ["XARGS"]="xargs"

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gentoo-portage-dev] PATCH: Only use lchown on symlinks (#98827)
  2005-07-18  3:13 [gentoo-portage-dev] PATCH: Make lchown a no-op rather than aliasing to chown on Darwin (#98827) Jason Stubbs
@ 2005-07-19 14:27 ` Jason Stubbs
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Stubbs @ 2005-07-19 14:27 UTC (permalink / raw
  To: gentoo-portage-dev


[-- Attachment #1.1: Type: text/plain, Size: 432 bytes --]

On Monday 18 July 2005 12:13, Jason Stubbs wrote:
> http://bugs.gentoo.org/show_bug.cgi?id=98827
> 
> 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.

-- 
Jason Stubbs

[-- Attachment #1.2: 98827_lchown_normal_files.patch --]
[-- Type: text/x-diff, Size: 1173 bytes --]

--- /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

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-19 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-18  3:13 [gentoo-portage-dev] PATCH: Make lchown a no-op rather than aliasing to chown on Darwin (#98827) Jason Stubbs
2005-07-19 14:27 ` [gentoo-portage-dev] PATCH: Only use lchown on symlinks (#98827) Jason Stubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox