summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2020-06-03 00:16:48 +0200
committerAndrew Gregory <andrew@archlinux.org>2020-06-18 11:05:38 +0200
commit22e6daa79455b1c59ab73af9438ca0c1d2a884b9 (patch)
tree29b4447840cc23deb695914f3f39ce2efcafc5ba /scripts
parentd69da08abef42a52d2fa81daf4c045c3305598cf (diff)
downloadpacman-22e6daa79455b1c59ab73af9438ca0c1d2a884b9.tar.gz
pacman-22e6daa79455b1c59ab73af9438ca0c1d2a884b9.tar.xz
makepkg: correctly handle missing download clients
This was broken in commit 882e707e40bbade0111cf3bdedbdac4d4b70453b, which changed 'plain()' messages to go to stdout, which was then captured as the download client in question: cmdline=("Aborting..."). The result was a very confusing error message e.g. /usr/share/makepkg/source/file.sh: line 72: $'\E[1m': command not found or with makepkg --nocolor: /usr/share/makepkg/source/file.sh: line 72: Aborting...: command not found The problem here is that we checked to see if an asynchronous subshell, in our case <(...), failed, by checking if its captured stdout is non-empty. Which is terrible, and also a limitation of old bash. But bash 4.4 can use wait $! to retrieve the return value of an asynchronous subshell. Now we target that as our minimum, we can sanely handle errors in such functions. Losing error messages on stdout by capturing them in a variable instead of printing them, continues to be a problem, but this will be fixed systematically in a later commit. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> (cherry picked from commit 381e11375569fa7588b1297e0e744749bdafe8f5)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/libmakepkg/source/file.sh.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/libmakepkg/source/file.sh.in b/scripts/libmakepkg/source/file.sh.in
index 819320c2..2b804564 100644
--- a/scripts/libmakepkg/source/file.sh.in
+++ b/scripts/libmakepkg/source/file.sh.in
@@ -42,7 +42,7 @@ download_file() {
# find the client we should use for this URL
local -a cmdline
IFS=' ' read -a cmdline < <(get_downloadclient "$proto")
- (( ${#cmdline[@]} )) || exit
+ wait $! || exit
local filename=$(get_filename "$netfile")
local url=$(get_url "$netfile")