[pacman-contrib] [PATCH 4/4] paccache: Exit when privilege escalation fails

Johannes Löthberg johannes at kyriasis.com
Wed Oct 12 10:00:04 UTC 2016


Pipelines run in subshells, so we need to set errexit for privilege
escalation failing to exit the script properly.

Fixes FS#44850.

Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
---
 src/paccache.sh.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/paccache.sh.in b/src/paccache.sh.in
index a7f9d62..e34f684 100644
--- a/src/paccache.sh.in
+++ b/src/paccache.sh.in
@@ -353,6 +353,9 @@ unset candtemp
 # do this before we destroy anything
 totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }')
 
+# Exit immediately if a pipeline returns non-zero.
+set -o errexit
+
 # crush. kill. destroy.
 (( verbose )) && cmdopts+=(-v)
 if (( delete )); then
-- 
2.10.0


More information about the pacman-contrib mailing list