[pacman-dev] [PATCH 3/3] paccache: proper quoting in [[ expression ]]

lolilolicon lolilolicon at gmail.com
Wed Sep 28 22:45:22 EDT 2011


Always quote the right-hand side of expression when the == or != operator
is used, unless intended as a pattern.

Signed-off-by: lolilolicon <lolilolicon at gmail.com>
---
 contrib/paccache.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/paccache.in b/contrib/paccache.in
index e5cac7d..4e185c2 100755
--- a/contrib/paccache.in
+++ b/contrib/paccache.in
@@ -153,7 +153,7 @@ summarize() {
 			while read -r pkg; do
 				if (( verbose >= 3 )); then
 					[[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]}
-					if [[ -z $seen || $seenarch != $arch || $seen != $name ]]; then
+					if [[ -z $seen || $seenarch != "$arch" || $seen != "$name" ]]; then
 						printf '%s (%s):\n' "$name" "$arch"
 					fi
 					printf '  %s\n' "$pkg"
-- 
1.7.6.4



More information about the pacman-dev mailing list