Unverified Commit 547a66d5 authored by Leonid Bloch's avatar Leonid Bloch Committed by Daniel M. Capella
Browse files

paccache: Support cleaning many thousands of candidates

In situations when there are many thousands of candidates for deletion,
paccache returns an "Argument list too long" error at the freed space
calculation stage, because the expansion of the ${candidates[@]} array
becomes too long for Bash.

This commit fixes that problem, by getting the @SIZECMD@ arguments via
`printf '%s\0' "${candidates[@]}" | xargs -0`, similarly to what is done
for the (re)moving commands below.
Signed-off-by: default avatarLeonid Bloch <lb.workbox@gmail.com>
Signed-off-by: default avatarDaniel M. Capella <polyzen@archlinux.org>
parent a1e7a764
......@@ -391,7 +391,8 @@ candidates=("${candtemp[@]}")
unset candtemp
# do this before we destroy anything
totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }')
totalsaved=$(printf '%s\0' "${candidates[@]}" | xargs -0 @SIZECMD@ |
awk '{ sum += $1 } END { print sum }')
# Exit immediately if a pipeline returns non-zero.
set -o errexit
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment