From 7febf540a9ab8f49f8ff111fe30ebccdd2e0d098 Mon Sep 17 00:00:00 2001 From: q66 Date: Mon, 23 Dec 2019 00:50:50 +0100 Subject: [PATCH] shutils/purge_distfiles.sh: fix purging of multiple distfiles Previously, xbps-src would try to find checksums in template files and not purge those found but it actually ignored everything that had the checksums specified on multiple lines. The reason for this is that the bash 'read' builtin reads until it finds a newline, and if you specify multiple checksums on multiple lines rather than on one line it would ignore all but the first. Fix this by replacing newlines with spaces, so that it can properly read all checksums into an array. --- common/xbps-src/shutils/purge_distfiles.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/xbps-src/shutils/purge_distfiles.sh b/common/xbps-src/shutils/purge_distfiles.sh index 558f34ca79..e3d577bd62 100644 --- a/common/xbps-src/shutils/purge_distfiles.sh +++ b/common/xbps-src/shutils/purge_distfiles.sh @@ -25,7 +25,7 @@ purge_distfiles() { pkg=${template#*/} pkg=${pkg%/*} if [ ! -L "srcpkgs/$pkg" ]; then - checksum="$(grep -Ehrow [0-9a-f]{$HASHLEN} ${template}|sort|uniq)" + checksum="$(grep -Ehrow [0-9a-f]{$HASHLEN} ${template}|sort|uniq|tr '\n' ' ')" read -a _my_hashes <<< ${checksum} i=0 while [ -n "${_my_hashes[$i]}" ]; do