public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] PATCH: Use lchown and lchgrp no-op functions when operating on symlinks (#99616)
@ 2005-07-21 14:13 Jason Stubbs
  2005-07-21 17:17 ` Brian D. Harring
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Stubbs @ 2005-07-21 14:13 UTC (permalink / raw
  To: gentoo-portage-dev


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

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

Similar to the usage of chown on Darwin in bug #98827, ebuild.sh uses chown
on symlinks which can alter the target where the intention is to modify the
symlink. This patch adds no-op lchown and lchgrp functions to ebuild.sh.
Profiles should override these to provide the correct implementation for
the specific userland.

(Apologies to the bug poster!)

-- 
Jason Stubbs

[-- Attachment #1.2: 99616_overridable_lchown_lchgrp.patch --]
[-- Type: text/x-diff, Size: 1447 bytes --]

diff -uNr portage-2.0.51.22-r2/bin/ebuild.sh portage-patched/bin/ebuild.sh
--- portage-2.0.51.22-r2/bin/ebuild.sh	2005-07-19 19:38:32.949904000 +0900
+++ portage-patched/bin/ebuild.sh	2005-07-21 23:03:58.429898000 +0900
@@ -85,6 +85,11 @@
 	export SANDBOX_PREDICT="$SANDBOX_PREDICT:$1"
 }
 
+lchown()
+{ 0; }
+
+lchgrp()
+{ 0; }
 
 # source the existing profile.bashrc's.
 save_IFS
@@ -1075,9 +1080,13 @@
 	local count=0
 	find "${D}/" -user  portage | while read file; do
 		count=$(( $count + 1 ))
-		[[ ! -L ${file} ]] && s=$(stat_perms $file)
-		chown root "$file"
-		[[ ! -L ${file} ]] && chmod "$s" "$file"
+		if [ -L "${file}" ]; then
+			lchown root "${file}"
+		else
+			s=$(stat_perms $file)
+			chown root "$file"
+			chmod "$s" "$file"
+		fi
 	done
 	if (( $count > 0 )); then
 		ewarn "$count files were installed with user portage!"
@@ -1086,13 +1095,13 @@
 	count=0
 	find "${D}/" -group portage | while read file; do
 		count=$(( $count + 1 ))
-		[[ ! -L ${file} ]] && s=$(stat_perms "$file")
-		if [ "$USERLAND" == "BSD" ] || [ "$USERLAND" == "Darwin" ];then
-			chgrp wheel "$file"
+		if [ -L ${file} ]; then
+			lchgrp 0 "${file}"
 		else
-			chgrp root "$file"
+			s=$(stat_perms "$file")
+			chgrp 0 "$file"
+			chmod "$s" "$file"
 		fi
-		[[ ! -L ${file} ]] && chmod "$s" "$file"
 	done
 	if (( $count > 0 )); then
 		ewarn "$count files were installed with group portage!"

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

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

end of thread, other threads:[~2005-08-09  7:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-21 14:13 [gentoo-portage-dev] PATCH: Use lchown and lchgrp no-op functions when operating on symlinks (#99616) Jason Stubbs
2005-07-21 17:17 ` Brian D. Harring
2005-07-21 23:49   ` Jason Stubbs
2005-08-05  3:31     ` [gentoo-portage-dev] PATCH: properly handle metadata transfer on first sync of an empty tree (#96410) Brian D. Harring
2005-08-05 11:20       ` Jason Stubbs
2005-08-09  7:19         ` Brian Harring
2005-08-06 23:30       ` Zac Medico

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