[pacman-dev] [PATCH 2/2] Revert "paccache: avoid subshell in calling runcmd"

Dave Reisner dreisner at archlinux.org
Wed May 15 09:58:43 EDT 2013


su is terribad. In addition to reverting, this also removes support for
privilege escalation via su. If you want to use paccache as root and
fail to comprehend how much better sudo is than su, then run paccache
directly via su.

Fixes FS#35173.

This reverts commit 597286eb258f841dfc00f65474138fc6192f0092.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 contrib/paccache.sh.in | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index 64c3c53..a9c6524 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -109,8 +109,7 @@ runcmd() {
 		if sudo -v &>/dev/null && sudo -l &>/dev/null; then
 			sudo "$@"
 		else
-			printf '%s ' 'root'
-			su -c "$(printf '%q ' "$@")"
+			die 'Unable to escalate privileges using sudo'
 		fi
 	else
 		"$@"
@@ -308,9 +307,9 @@ totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }
 # crush. kill. destroy.
 (( verbose )) && cmdopts+=(-v)
 if (( delete )); then
-	runcmd xargs -0a <(printf '%s\0' "${candidates[@]}") rm "${cmdopts[@]}"
+	printf '%s\0' "${candidates[@]}" | runcmd xargs -0 rm "${cmdopts[@]}"
 elif (( move )); then
-	runcmd xargs -0a <(printf '%s\0' "${candidates[@]}") mv "${cmdopts[@]}" -t "$movedir"
+	printf '%s\0' "${candidates[@]}" | runcmd xargs -0 mv "${cmdopts[@]}" -t "$movedir"
 fi
 
 summarize "$pkgcount" "${candidates[@]}"
-- 
1.8.2.3



More information about the pacman-dev mailing list