Skip to content

fix: exit non-zero when the asdf download fails - #623

Open
blimmer wants to merge 2 commits into
asdf-vm:masterfrom
blimmer:fix/curl-fail-on-http-error
Open

fix: exit non-zero when the asdf download fails#623
blimmer wants to merge 2 commits into
asdf-vm:masterfrom
blimmer:fix/curl-fail-on-http-error

Conversation

@blimmer

@blimmer blimmer commented Aug 12, 2026

Copy link
Copy Markdown

Fixes #622.

curl ran without --fail, so an HTTP error exited 0 and the response body got written to downloadPath. tar then failed on it with not in gzip format, one step after the download had already reported success.

Reproduced against a missing release asset:

$ curl -sSL -o out.tar.gz <404 url>
exit=0, out.tar.gz contains "Not Found"

$ curl -fsSL --retry 5 --retry-all-errors -o out.tar.gz <404 url>
exit=56, no file written

The first commit here is @CGA1123's from #608, cherry-picked unchanged. --retry 5 helps but doesn't close the hole on its own: a non-transient status isn't retried, and once retries run out curl still exits 0 and still writes the body. --fail is what turns the corrupt file into an error you can actually see.

On --retry-all-errors: a genuine 404 now takes ~30s to fail instead of failing immediately. That seemed like the right trade, since the download URL comes from release metadata fetched moments earlier, so an error on it is unexpected rather than a caller mistake. Happy to drop it if you'd rather fail fast.

Tagged this as v4.0.1-curl-fail.1 on my fork if anyone needs it before this merges.

CGA1123 and others added 2 commits August 12, 2026 15:01
Sometimes GitHub can be having a bad time. `curl` implements a default
exponential backoff retry, which should help mitigate any partial
failures that GitHub might experience and allow builds to continue.
--retry alone does not stop a failed download from being extracted. curl
ran without --fail, so an HTTP error exited 0 and the response body was
written to downloadPath. tar then failed on it with "not in gzip format",
one step after the download had already reported success.

Reproduced against a missing release asset:

  curl -sSL -o out.tar.gz <404 url>   # exit 0, out.tar.gz contains "Not Found"
  curl -fsSL -o out.tar.gz <404 url>  # non-zero exit, no file written

--retry-all-errors covers the rest: a non-transient status is not in
--retry's set, and a truncated transfer is not retried without it. The
download URL comes from release metadata fetched moments earlier, so an
error on it is unexpected rather than a caller mistake, which makes
retrying every error preferable to failing fast on the first one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setup: curl without --fail lets a failed download reach tar ("not in gzip format")

2 participants