You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
info: show dependents recorded under other names - #24516
brew info -v can show no dependents for a keg that brew uninstall refuses to remove because of its dependents, which makes the keg look safe to delete when it isn't. I hit this with an icu4c keg from 2022. icu4c has since become an alias of icu4c@79, and the keg is still in Cellar/icu4c/70.1.
To reproduce, you need a keg installed before its formula became an alias, plus a dependent from that time:
$ brew info -v icu4c
$ brew info -v icu4c@79
$ brew uses --installed icu4cmysqlnodepostgresql@18yarn
$ brew uninstall icu4cError: Refusing to uninstall /usr/local/Cellar/icu4c/70.1because it is required by mysql, node, postgresql@18 and yarn, which are currently installed.
Both brew info commands print the keg but no "Dependencies" section at all.
Loading the arguments resolves the alias, so both commands run as the icu4c@79 formula and only search install receipts for that name. Receipts keep the dependency name from install time, here icu4c, so they never match. brew info already finds the keg itself through Formula#possible_names, which covers the formula name, old names and aliases.
This matches receipts against Formula#possible_names too, so both commands now print:
brew info prints keg names, which is why it says postgresql where brew uninstall says postgresql@18.
Across my 159 installed formulae this changes four. Besides icu4c@79, openssl@4 and python@3.15 gain mercurial and pkgconf gains libpthread-stubs, libx11 and libxcb. The lists for those three now match brew uses --installed exactly.
Have you checked for other open Pull Requests for the same change?
Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
Have you explained why you'd like these changes included, not just what they do?
For bug fixes, have you given step-by-step brew commands to reproduce the bug?
Have you written new tests (excluding integration tests)? Here's an example.
Have you successfully run brew lgtm (style, typechecking and tests) locally?
I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.
Claude Code (Claude Opus 5.5) traced why brew info and brew uninstall disagreed, wrote the change and its spec and verified them. The new spec fails without the change and passes with it. It ran the reproduction steps on main and on this branch, compared the dependents of my installed formulae before and after and ran brew lgtm, which passes.
- `brew info -v icu4c` and `brew info -v icu4c@79` both showed no
dependents for a keg in `Cellar/icu4c`. Loading the arguments
resolves the alias, so both run as the `icu4c@79` formula and only
search receipts for that name.
- Receipts keep the dependency name from install time, so kegs built
against `icu4c` never matched, even though `brew uses` and
`brew uninstall` report those same kegs as dependents.
- Match against `Formula#possible_names`, which is also what finds the
installed kegs. It covers the formula name, old names and aliases.
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Verbose formula information now counts installed dependents whose recorded runtime dependency uses the formula’s canonical name, an alias, a previous name or a tap-qualified name.
Dependents recorded under unrelated names are excluded from the count, providing a more accurate view of installed dependents.
The info command now checks installed runtime dependency receipts against all possible formula names. A verbose inventory test covers canonical, alias, old-name and tap-qualified matches, and excludes a dependent recorded with an unrelated name.
Changes: Dependent name matching
Layer / File(s)
Summary
Match receipt names and verify counts Library/Homebrew/cmd/info.rb, Library/Homebrew/test/cmd/info_spec.rb
installed_dependent_names accepts multiple names, and the formula information path supplies formula.possible_names. The test checks alias, old-name and tap-qualified matches, and excludes an unrelated name.
Merge Risk: Low · up to 0d658
The dependent list can include an unrelated formula in a cross-tap name collision. This is a bounded display risk and does not block merging.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title describes the change to show dependents recorded under other formula names.
Description check
The description explains the dependent matching issue, the change, and the related tests.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: d037a9e9-11d8-4f7c-9f4d-4d9149d17572
Commits
Reviewing files that changed from the base of the PR and between 8ce00b4 and 0d6586e.
Files selected for processing: 1
Library/Homebrew/test/cmd/info_spec.rb
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The example covers bare alias and old-name receipts, but it does not exercise the Utils.name_from_full_name path used for a receipt such as homebrew/core/testball. Add one qualified dependency and assert that it is included.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: ccf3241a-12e4-4fe6-b9aa-503acbbf6c90
Commits
Reviewing files that changed from the base of the PR and between 88f401f and 8ce00b4.
Files selected for processing: 2
Library/Homebrew/cmd/info.rb
Library/Homebrew/test/cmd/info_spec.rb
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
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
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.
brew info -vcan show no dependents for a keg thatbrew uninstallrefuses to remove because of its dependents, which makes the keg look safe to delete when it isn't. I hit this with anicu4ckeg from 2022.icu4chas since become an alias oficu4c@79, and the keg is still inCellar/icu4c/70.1.To reproduce, you need a keg installed before its formula became an alias, plus a dependent from that time:
Both
brew infocommands print the keg but no "Dependencies" section at all.Loading the arguments resolves the alias, so both commands run as the
icu4c@79formula and only search install receipts for that name. Receipts keep the dependency name from install time, hereicu4c, so they never match.brew infoalready finds the keg itself throughFormula#possible_names, which covers the formula name, old names and aliases.This matches receipts against
Formula#possible_namestoo, so both commands now print:brew infoprints keg names, which is why it sayspostgresqlwherebrew uninstallsayspostgresql@18.Across my 159 installed formulae this changes four. Besides
icu4c@79,openssl@4andpython@3.15gainmercurialandpkgconfgainslibpthread-stubs,libx11andlibxcb. The lists for those three now matchbrew uses --installedexactly.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code (Claude Opus 5.5) traced why
brew infoandbrew uninstalldisagreed, wrote the change and its spec and verified them. The new spec fails without the change and passes with it. It ran the reproduction steps onmainand on this branch, compared the dependents of my installed formulae before and after and ranbrew lgtm, which passes.