From af8f129dc6ccff46919bb136ee460aa892dc660f Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Mon, 6 Nov 2017 15:03:55 +0100 Subject: udd-query: multiarch_versionskew: check the count of elements in the file instead of file size psql now always print at least a newline, even if no records are returned, that broke our `[ -s $UDD ]` check. Read the whole file once and put it in a bash array for futher usage, including counting the elements. Closes: #864238 Signed-off-by: Mattia Rizzolo --- bin/udd-query.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/udd-query.sh b/bin/udd-query.sh index fb62c8cb..1e18558d 100755 --- a/bin/udd-query.sh +++ b/bin/udd-query.sh @@ -46,7 +46,8 @@ multiarch_versionskew() { ORDER BY source ;" udd_query - if [ -s $UDD ] ; then + local PKGS=($(< "$UDD")) + if [ ${#PKGS[@]} -gt 0 ] ; then if [ "$DISTRO" != "sid" ] ; then echo "Warning: multi-arch version skew in $DISTRO detected." else @@ -55,9 +56,8 @@ multiarch_versionskew() { fi echo printf " Package | Tracker\n" - # bash sucks: it's printf(1) implementation doesn't like leading dashes as-is... printf -- "--------------------------------------------------------------------------\n" - for pkg in $(cat $UDD) ; do + for pkg in "${PKGS[@]}" ; do printf "%25s | %s\n" "$pkg" "https://tracker.debian.org/$pkg" # TODO: show versions (per arch) too done -- cgit v1.2.3-54-g00ecf