[pacman-dev] [PATCH] paccache: use xargs to execute mv/rm commands

Dave Reisner dreisner at archlinux.org
Sun Feb 17 12:02:20 EST 2013


This removes the restriction on the length of the command line, as xargs
will work around by running multiple instances of the command for us.

As seen: https://bbs.archlinux.org/viewtopic.php?pid=1232959

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

diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index 74bac8a..46eb230 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -310,9 +310,9 @@ totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }
 # crush. kill. destroy.
 (( verbose )) && cmdopts+=(-v)
 if (( delete )); then
-	runcmd rm "${cmdopts[@]}" "${candidates[@]}"
+	printf '%s\0' "${candidates[@]}" | runcmd xargs -0 rm "${cmdopts[@]}"
 elif (( move )); then
-	runcmd mv "${cmdopts[@]}" "${candidates[@]}" "$movedir"
+	printf '%s\0' "${candidates[@]}" | runcmd xargs -0 mv "${cmdopts[@]}" -t "$movedir"
 fi
 
 summarize "$pkgcount" "${candidates[@]}"
-- 
1.8.1.3



More information about the pacman-dev mailing list