public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] resend of 99616 overridable lchown/lchgrp
@ 2005-09-27  4:28 Jason Stubbs
  2005-09-27  4:39 ` Jason Stubbs
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Stubbs @ 2005-09-27  4:28 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

Same deal as last time. This is resynced against current subversion and now 
provides a default implementation of lchown and lchgrp that are safe on GNU 
systems.

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

diff -uNr 2.0/bin/ebuild.sh 2.0-patched/bin/ebuild.sh
--- 2.0/bin/ebuild.sh	2005-09-26 11:48:16.000000000 +0900
+++ 2.0-patched/bin/ebuild.sh	2005-09-27 13:26:09.000000000 +0900
@@ -83,6 +83,15 @@
 	export SANDBOX_PREDICT="$SANDBOX_PREDICT:$1"
 }
 
+lchown()
+{
+	chown -h "$@"
+}
+
+lchgrp()
+{
+	chgrp -h "$@"
+}
 
 # source the existing profile.bashrc's.
 save_IFS
@@ -1133,15 +1142,17 @@
 	local count=0
 	find "${D}/" -user  portage | while read file; do
 		count=$(( $count + 1 ))
-		if [ ! -L "${file}" ]; then
-			s=$(stat_perms "$file")
+		if [ -L "${file}" ]; then
+			lchown 0 "${file}"
+		else
+			s=$(stat_perms $file)
 			if [ -z "${s}" ]; then
 				ewarn "failed stat_perm'ing $file.  User intervention during install isn't wise..."
 				continue
 			fi
+			chown 0 "$file"
+			chmod "$s" "$file"
 		fi
-		chown root "$file"
-		[[ ! -L "${file}" ]] && chmod "$s" "$file"
 	done
 	if (( $count > 0 )); then
 		ewarn "$count files were installed with user portage!"
@@ -1150,15 +1161,17 @@
 	count=0
 	find "${D}/" -group portage | while read file; do
 		count=$(( $count + 1 ))
-		if [ ! -L "${file}" ]; then
+		if [ -L ${file} ]; then
+			lchgrp 0 "${file}"
+		else
 			s=$(stat_perms "$file")
 			if [ -z "${s}" ]; then
 				echo "failed stat_perm'ing '$file' . User intervention during install isn't wise..."
 				continue
 			fi
+			chgrp 0 "$file"
+			chmod "$s" "$file"
 		fi
-		chgrp 0 "${file}"
-		[[ ! -L "${file}" ]] && chmod "$s" "$file"
 	done
 	if (( $count > 0 )); then
 		ewarn "$count files were installed with group portage!"

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

* Re: [gentoo-portage-dev] [PATCH] resend of 99616 overridable lchown/lchgrp
  2005-09-27  4:28 [gentoo-portage-dev] [PATCH] resend of 99616 overridable lchown/lchgrp Jason Stubbs
@ 2005-09-27  4:39 ` Jason Stubbs
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Stubbs @ 2005-09-27  4:39 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 36 bytes --]

Getting rid of the magic constants.

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

diff -uNr 2.0/bin/ebuild.sh 2.0-patched/bin/ebuild.sh
--- 2.0/bin/ebuild.sh	2005-09-26 11:48:16.000000000 +0900
+++ 2.0-patched/bin/ebuild.sh	2005-09-27 13:37:33.000000000 +0900
@@ -83,6 +83,15 @@
 	export SANDBOX_PREDICT="$SANDBOX_PREDICT:$1"
 }
 
+lchown()
+{
+	chown -h "$@"
+}
+
+lchgrp()
+{
+	chgrp -h "$@"
+}
 
 # source the existing profile.bashrc's.
 save_IFS
@@ -996,6 +1005,8 @@
 }
 	
 
+PORTAGE_INST_UID="0"
+PORTAGE_INST_GID="0"
 
 dyn_install() {
 	trap "abort_install" SIGINT SIGQUIT
@@ -1133,15 +1144,17 @@
 	local count=0
 	find "${D}/" -user  portage | while read file; do
 		count=$(( $count + 1 ))
-		if [ ! -L "${file}" ]; then
-			s=$(stat_perms "$file")
+		if [ -L "${file}" ]; then
+			lchown ${PORTAGE_INST_UID} "${file}"
+		else
+			s=$(stat_perms $file)
 			if [ -z "${s}" ]; then
 				ewarn "failed stat_perm'ing $file.  User intervention during install isn't wise..."
 				continue
 			fi
+			chown ${PORTAGE_INST_UID} "$file"
+			chmod "$s" "$file"
 		fi
-		chown root "$file"
-		[[ ! -L "${file}" ]] && chmod "$s" "$file"
 	done
 	if (( $count > 0 )); then
 		ewarn "$count files were installed with user portage!"
@@ -1150,15 +1163,17 @@
 	count=0
 	find "${D}/" -group portage | while read file; do
 		count=$(( $count + 1 ))
-		if [ ! -L "${file}" ]; then
+		if [ -L ${file} ]; then
+			lchgrp ${PORTAGE_INST_GID} "${file}"
+		else
 			s=$(stat_perms "$file")
 			if [ -z "${s}" ]; then
 				echo "failed stat_perm'ing '$file' . User intervention during install isn't wise..."
 				continue
 			fi
+			chgrp ${PORTAGE_INST_GID} "$file"
+			chmod "$s" "$file"
 		fi
-		chgrp 0 "${file}"
-		[[ ! -L "${file}" ]] && chmod "$s" "$file"
 	done
 	if (( $count > 0 )); then
 		ewarn "$count files were installed with group portage!"

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

end of thread, other threads:[~2005-09-27  4:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-27  4:28 [gentoo-portage-dev] [PATCH] resend of 99616 overridable lchown/lchgrp Jason Stubbs
2005-09-27  4:39 ` Jason Stubbs

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