Repository navigation
formula: handle non-VCS head in outdated - #24412
Conversation
- `latest_head_pkg_version` called `downloader.last_commit` unconditionally, but a `head` spec can point to an archive URL whose downloader is not a `VCSDownloadStrategy` and has no `last_commit` - `brew outdated` crashed for HEAD kegs considered outdated via the stable version check, e.g. `pspp (HEAD)` after a stable bump - fall back to the installed HEAD version so verbose output prints `latest HEAD` as it did before
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Handle non-VCS HEAD versions Library/Homebrew/formula.rb, Library/Homebrew/test/formula_spec.rb |
The method returns the latest installed version for non-VCS HEAD downloaders. The test checks the HEAD package version and revision 0 when the installed tab records stable version 1.0. VCS downloaders retain the existing commit-based version calculation. |
Merge Risk: 
Minimal · up to 680aa
-
The non-VCS HEAD fallback and regression coverage are aligned with the stated fix.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "formula: handle non-VCS head in outdated" matches the main change. The PR makes Formula#latest_head_pkg_version return the installed HEAD version when the HEAD downloader is not a VCSDownloadStrategy, which stops the brew outdated crash. The title is specific and concise, and it names the affected area.
Full details: Description check
-
Explanation
The description explains the crash in brew outdated for formulae whose head spec is a plain archive URL. It names the cause (an unguarded downloader.last_commit call), gives reproduction steps, and describes the fix and the regression test. It is directly related to the changeset.
-
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks for the PR! Why use a non-VCS head URL? Want to figure out what makes most sense, particularly given this has been broken for a year and you're first to complain.
I think it's not a choice on my end — Probably nobody hit it before because it needs a narrow combination: a non-VCS head, a On direction: for a non-VCS downloader there is no upstream commit to report, and fetching the archive would defeat |
brew outdatedcrashes for formulae installed from HEAD whoseheadspecis not a VCS URL:
Formula#latest_head_pkg_versioncallsdownloader.last_commitunconditionally, but that method only exists on
VCSDownloadStrategy. Aformula's
headcan point to a plain archive URL (e.g.fredowski/pspp/psppuseshead ".../latest-source.tar.gz"), which givesa
CurlDownloadStrategy.The crash triggers whenever a HEAD keg is deemed outdated without
--fetch-HEAD: after the formula's stable version is bumped past the onerecorded in the keg's tab,
head_version_outdated?returns true via thestable comparison and the unguarded
last_commitcall runs. Verboseoutput is the default in interactive shells, so plain
brew outdatedhits this too. Introduced by #20940.
To reproduce:
brew install --HEADa formula whoseheadis an archiveURL, wait until its stable version is bumped (or lower the
"stable"version recorded in the keg's
INSTALL_RECEIPT.json), then runbrew outdatedin a terminal orbrew outdated -vanywhere.When
head_spec.downloaderis not aVCSDownloadStrategythere is noupstream commit to report, so return the installed HEAD version and let
verbose output fall back to printing
latest HEAD, as it did before#20940. Adds a regression test.
brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Drafted with AI assistance (Devin, SWE-2); code, tests and prose reviewed by me before submission.