fetchurl: builder.sh: handle urls as a Bash array#471851
fetchurl: builder.sh: handle urls as a Bash array#471851MattSturgeon merged 10 commits intoNixOS:masterfrom
urls as a Bash array#471851Conversation
MattSturgeon
left a comment
There was a problem hiding this comment.
Initial read through the diff, without cloning or testing.
Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
5c2f3f6 to
13af71d
Compare
|
MattSturgeon
left a comment
There was a problem hiding this comment.
LGTM. The test failures seem to be darwin-specific network issues? I wonder if sandbox = off would resolve them?
ca58959 to
65a6b72
Compare
I guess it is transient. GitHub seems to suffer from connection instability again. Quite some of my PRs suffer from CI check failures due to failed connection. |
|
I'll do x86_64-darwin builds with and without sandbox, to satisfy my curiosity:
But either way, I think we should merge this promptly as it's a correctness fix for a core part of nixpkgs. If any issues are pointed out post-merge they can be dealt with in follow-up PRs. |
|
My |
Wait a minute. I found a syntax error in the seldom-checked |
|
65a6b72 to
a3ea395
Compare
|
@SuperSandro2000, are you available for a final look? |
2a8dade to
20e0811
Compare
| urls="$urls2" | ||
| urls=("${urlsResolved[@]}") | ||
|
|
||
| unset urlsResolved |
There was a problem hiding this comment.
Let's just do unset urls instead of all the "redefine the same name" thing. Let's use urlsResolved further down.
There was a problem hiding this comment.
This would further change how postFetch would access the URL list. Should we add a release note entry about this fix?
I haven't found any fetchurl's postFetch referencing "$urls", but a close example is fetchelpa referencing $url, the URL of the successful download.
nixpkgs/pkgs/applications/editors/emacs/elisp-packages/fetchelpa.nix
Lines 18 to 22 in 4f0dadb
There was a problem hiding this comment.
We never state that the $urls will always be handled the same way in fetchurl.builder across Nixpkgs revision, and developers of downstream projects should be able to handle this.
Applied.
|
Diff LGTM except the nit above; didn't test. |
|
20e0811 to
cfdd4a3
Compare
Clean up leftover for commit cd13136 ("fetchurl: use __structuredAttrs = true and pass curlOptsList directly") Continue the work of commit 23236b3 ("fetchurl: fix handling of fallback URLs"), addressing a Bash array re-assignment quirk: when assigning a Bash array variable as if it were a plain variable, the value goes to the first element, and the rest of the array stays the same. ```console $ foo=(a b) $ declare -p foo declare -a foo=([0]="a" [1]="b") $ foo="c d" $ declare -p foo declare -a foo=([0]="c d" [1]="b") ``` Don't rewrite the `${urls[@]}` with resolved URLs, but hold them with `${resolvedUrls[@]}` instead. Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk> Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
…re name arguments
3a1ee2a to
0b27145
Compare
|
I just pushed the following changes:
|
MattSturgeon
left a comment
There was a problem hiding this comment.
Still LGTM. Let's get this merged.
Clean up leftover for PR #464475.
Revert and re-implementContinue the work of PR #470643 to address a Bash variable reassignment quirk:PR #470643 probably does make the mirror fetching. Even if it doesn't clean up the "mirror://" pseudo-URL, it does add the resolved URLs which
curlwill use to download the file. We revert and re-implement in the same PR to avoid re-introducing the breakage PR #470643 has fixed.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.