Repository navigation
curl: stop retrying local download write failures - #24275
Merged
Merged
Conversation
Contributor
Author
|
btw, when extracting the download contents and there's insufficient storage, the failure also isn't handled and create a bunch of unreadable error messages. i might open a pr later to fix that after this one is done |
BrandenXia
marked this pull request as ready for review
October 17, 2026 00:53
Contributor
8 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a download runs out of local disk space, curl exits with
CURLE_WRITE_ERROR(23). Homebrew currently wraps this as an ordinary download failure, tries any mirrors and letsRetryableDownloadrepeat the transfer. Changing servers cannot fix a local write failure, and the existing error does not identify the destination or suggest checking storage.Raise a separate
DownloadWriteErrorfromUtils::Curl.curl_downloadfor exit 23. This bypasses mirror fallback and download retries, reports the destination with guidance to check free space and permissions, and retains curl's diagnostic and the original exception as the cause. Partial downloads remain available for a later resume. Other curl failures keep their existing handling. Exit 23 also covers permission and other local write errors, so the message deliberately does not assert that the disk is full. See curl's error-code documentation.This change covers curl download write failures; it does not estimate space required to unpack or build packages.
Reproduction
On a machine whose Homebrew cache volume is full, run
brew fetch --retry llvm. Before this change, a local write failure is handled as a retryable download error. After this change, the affected download stops with its destination and actionable guidance.For a bounded reproduction without filling a disk, run this from the repository root. A temporary file-size limit causes the same curl exit 23:
Validation
./bin/brew tests --only=utils/curl:869,utils/curl:887,download_strategies/curl:116,retryable_download:15../bin/brew lgtm --onlinepassed: global type checking, style and the relevant tests.DownloadWriteError, preserved the original exception and retained 1,024 partial bytes.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?OpenAI Codex (GPT-6) investigated the failure path, wrote the change and regression tests, and ran the validation above. I reviewed the code and made sure that this is not slopping.
Summary by CodeRabbit