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's avatarMattia Rizzolo <mattia@debian.org>
parent c45bf9c4
......@@ -46,7 +46,8 @@ multiarch_versionskew() {
ORDER BY source ;"
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."
......@@ -55,9 +56,8 @@ multiarch_versionskew() {
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
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