Revert "paccache: avoid subshell in calling runcmd"

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 597286eb25.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Dave Reisner 2013-05-15 09:58:43 -04:00 committed by Allan McRae
parent 72c6d19d64
commit 8be08f7cae

View file

@ -109,8 +109,7 @@ runcmd() {
if sudo -v &>/dev/null && sudo -l &>/dev/null; then if sudo -v &>/dev/null && sudo -l &>/dev/null; then
sudo "$@" sudo "$@"
else else
printf '%s ' 'root' die 'Unable to escalate privileges using sudo'
su -c "$(printf '%q ' "$@")"
fi fi
else else
"$@" "$@"
@ -308,9 +307,9 @@ totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }
# crush. kill. destroy. # crush. kill. destroy.
(( verbose )) && cmdopts+=(-v) (( verbose )) && cmdopts+=(-v)
if (( delete )); then if (( delete )); then
runcmd xargs -0a <(printf '%s\0' "${candidates[@]}") rm "${cmdopts[@]}" printf '%s\0' "${candidates[@]}" | runcmd xargs -0 rm "${cmdopts[@]}"
elif (( move )); then 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 fi
summarize "$pkgcount" "${candidates[@]}" summarize "$pkgcount" "${candidates[@]}"