From 23236b331d061aa07dc328c706b1b22fd95b27db Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sun, 14 Dec 2025 07:22:20 +0000 Subject: [PATCH] fetchurl: fix handling of fallback URLs Without the change fallback to `urls = []` does not work as `$urls` evaluates on ony first entry. Use `${urls[@]}` instead. Example derivation that is fixed in `master` is `xterm.src`: Before: $ nix build --no-link -f. xterm.src --rebuild -L xterm> structuredAttrs is enabled ... xterm> trying ftp://ftp.invisible-island.net/xterm/xterm-403.tgz ... xterm> curl: (67) Access denied: 550 xterm> error: cannot download xterm-403.tgz from any mirror After: $ nix build --no-link -f. xterm.src --rebuild -L xterm> structuredAttrs is enabled ... xterm> trying ftp://ftp.invisible-island.net/xterm/xterm-403.tgz ... xterm> curl: (67) Access denied: 550 ... xterm> trying https://invisible-mirror.net/archives/xterm/xterm-403.tgz xterm> % Total % Received % Xferd Average Speed Time Time Time Current xterm> Dload Upload Total Spent Left Speed xterm> 100 1577k 100 1577k 0 0 703670 0 0:00:02 0:00:02 --:--:-- 703866 --- pkgs/build-support/fetchurl/builder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh index 44ac80737bc07..ae6c372208e12 100644 --- a/pkgs/build-support/fetchurl/builder.sh +++ b/pkgs/build-support/fetchurl/builder.sh @@ -109,7 +109,7 @@ tryHashedMirrors() { set -o noglob urls2= -for url in $urls; do +for url in "${urls[@]}"; do if test "${url:0:9}" != "mirror://"; then urls2="$urls2 $url" else