[pacman-dev] [PATCH 1/3] paccache: exit in case of pacman error when -u flag is used

Dave Reisner dreisner at archlinux.org
Fri Jan 9 20:52:23 UTC 2015


From: Dario Giovannetti <dariogiova at gmail.com>

Fixes https://bugs.archlinux.org/task/43286

Signed-off-by: Dario Giovannetti <dariogiova at gmail.com>
---
 contrib/paccache.sh.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index 6a68d4d..1690583 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -256,6 +256,8 @@ while :; do
 			delete=1 ;;
 		-u|--uninstalled)
 			IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
+			# pacman -Qq may exit with an error, thus making ign an empty array
+			(( ${#ign[@]} )) || die 'failed to retrieve the list of installed packages'
 			blacklist+=("${ign[@]}")
 			unset ign ;;
 		-V|--version)
-- 
2.2.1


More information about the pacman-dev mailing list