Is there any feedback on my recent post?

The collision-protect feature didn't recognize two files as the same, if they 
were symlinked.
i.e. /usr/FILE and /usr/X11R6/FILE caused a collision, while X11R6 -> . linked

This patch for portage-2.1 should fix this. Works fine for me in all thinkable 
scenarios.
Can you please test and/or review it?

Fixing bug: http://bugs.gentoo.org/show_bug.cgi?id=80846

Thank you a lot
Thomas
diff -ur portage-2.1_pre3/pym/portage.py portage-2.1_pre3-r2/pym/portage.py
--- portage-2.1_pre3/pym/portage.py	2005-12-31 07:24:24.000000000 +0100
+++ portage-2.1_pre3-r2/pym/portage.py	2006-01-03 18:10:22.000000000 +0100
@@ -5917,6 +5917,21 @@
 					if (ver.isowner(f, destroot) or ver.isprotected(f)):
 						isowned = True
 						break
+					# Look for same inodes as f in other versions => means no collision
+					if ver.getcontents()==None:
+						continue
+					for myf in ver.getcontents():
+						if not os.path.exists(myf):
+							continue
+						if os.path.samefile(f, myf):
+							myrealpath = os.path.realpath(f)
+							if myrealpath==f:
+								myotherpath=myf
+							else:
+								myotherpath=f
+							print yellow("*")+" "+myotherpath+" points to "+myrealpath
+							isowned = True
+							break
 				if not isowned:
 					print "existing file "+f+" is not owned by this package"
 					stopmerge=True

Reply via email to