G
YouTube TikTok Games
Skip to content

info: show dependents recorded under other names - #24516

Merged
HaraldNordgren merged 2 commits into
mainfrom
info-dependents-possible-names
Nov 6, 2026
Merged

HaraldNordgren merged 2 commits into
mainfrom
info-dependents-possible-names

Conversation

@HaraldNordgren

Copy link
Copy Markdown
Member

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 icu4c
mysql
node
postgresql@18
yarn
$ brew uninstall icu4c
Error: Refusing to uninstall /usr/local/Cellar/icu4c/70.1
because 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:

==> Dependencies
Dependents (4): mysql, node, postgresql, yarn

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 followed our Contributing guidelines?
  • 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.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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: Passed 4

Check name Status Explanation
Title check Passed The title describes the change to show dependents recorded under other formula names.
Description check Passed The description explains the dependent matching issue, the change, and the related tests.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick comments: 1

Library/Homebrew/test/cmd/info_spec.rb: 1

757-759: Trivial · Maintainability & Code Quality · Quick win

Cover tap-qualified dependency receipts.

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.

Suggested test update

       "alias-dependent"   => "testball",
       "oldname-dependent" => "old-testball",
+      "qualified-dependent" => "homebrew/core/testball",
       "other-dependent"   => "other-formula",
@@
-      .to output(/^Dependents \(2\): alias-dependent, oldname-dependent$/).to_stdout
+      .to output(/^Dependents \(3\): alias-dependent, oldname-dependent, qualified-dependent$/).to_stdout

Source: Learnings

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: 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.

Comment thread Library/Homebrew/test/cmd/info_spec.rb Resolved
- Dropping the `dep_full_name == full_name` branch leaves only
  `Utils.name_from_full_name` matching these, so pin it in the spec.
@HaraldNordgren
HaraldNordgren added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 18fa38e Nov 6, 2026
55 checks passed
@HaraldNordgren
HaraldNordgren deleted the info-dependents-possible-names branch November 6, 2026 19:58
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.

2 participants