Summary
Split off from review discussion on #304.
download_file in arcup/arcup relies on curl's exit code to detect
failed downloads:
if ! curl_with_headers -#fL --max-time 900 -o "$output_path" "$url"; then
rm -f "$output_path"
download_error "$tag" "$filename" "$url"
fi
curl_with_headers includes CURL_RETRY_ARGS=(--retry 3 --retry-delay 2 --connect-timeout 15). On curl 8.14.0 and 8.14.1, combining --retry with
--fail causes curl to exit 0 even on a 404 (upstream bug, see
curl/curl#17554 — fixed in later releases; --retry 0 or omitting
--retry exits 22 correctly on those versions).
Reproduced by running the arcup test suite's e2e test against main on a
box with curl 8.14.1: instead of download_error's intended message, the
script fails later with Checksum file is empty: … — a much less useful
error for whoever hits it.
Impact
The install still fails closed (checksum verification catches the empty/
missing file downstream), so this isn't a security issue — just a
misleading-error-message issue on a curl line version that ships in
current distros and nixpkgs.
Suggested fix
Add an explicit non-empty-file check after the curl call in download_file
(and download_file_with_github_api, which has the same pattern),
independent of curl's exit code:
if ! curl_with_headers -#fL --max-time 900 -o "$output_path" "$url" || [[ ! -s "$output_path" ]]; then
rm -f "$output_path"
download_error "$tag" "$filename" "$url"
fi
This immunizes the check against the curl version-specific behavior
rather than depending on the exit code alone.
Summary
Split off from review discussion on #304.
download_fileinarcup/arcuprelies on curl's exit code to detectfailed downloads:
curl_with_headersincludesCURL_RETRY_ARGS=(--retry 3 --retry-delay 2 --connect-timeout 15). On curl 8.14.0 and 8.14.1, combining--retrywith--failcauses curl to exit 0 even on a 404 (upstream bug, seecurl/curl#17554 — fixed in later releases;
--retry 0or omitting--retryexits 22 correctly on those versions).Reproduced by running the
arcuptest suite's e2e test againstmainon abox with curl 8.14.1: instead of
download_error's intended message, thescript fails later with
Checksum file is empty: …— a much less usefulerror for whoever hits it.
Impact
The install still fails closed (checksum verification catches the empty/
missing file downstream), so this isn't a security issue — just a
misleading-error-message issue on a curl line version that ships in
current distros and nixpkgs.
Suggested fix
Add an explicit non-empty-file check after the curl call in
download_file(and
download_file_with_github_api, which has the same pattern),independent of curl's exit code:
This immunizes the check against the curl version-specific behavior
rather than depending on the exit code alone.