Repository navigation
List formula versions using bash - #24373
Conversation
📝 Summary
Priority: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 1

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:
2c719050-561a-4f7f-82f6-f14eaf9614ff
Files selected for processing: 3-
Library/Homebrew/cmd/list.rbLibrary/Homebrew/list.shLibrary/Homebrew/test/cmd/list_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.
-
- `brew list --versions <formula>` and `brew list --versions --formula` started Ruby only to read directory names from the Cellar. Scripts often use the former to check whether formulae are installed. - `list.sh` now prints these for plain formula names, sorted as Ruby sorts them, or for every formula when `--formula` is given or no casks are installed. - Casks, aliases, renamed formulae, tap-qualified names, flags Ruby rejects alongside `--versions` and formulae with more than one version installed, which Ruby lists in directory order, still go to Ruby.
2b3edc2 to
e79cfc0
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

Major · Guard the empty racks expansion. · list.sh:331
Library/Homebrew/list.sh:331
🩺 Stability & Availability | 🟠 Major | ⚡ Quick winGuard the empty
racksexpansion.On macOS Bash 3.2,
brew list --versions --formulaaborts when the Cellar has no racks.bin/brewenables nounset, and expanding an empty array causes an unbound-variable error before Ruby can handle the request. (raw.githubusercontent.com)Guard the expansion and test this case with nounset enabled.

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:
624d9eaf-0d2a-4d88-b3f0-e2b90eb145b1
Files selected for processing: 2-
Library/Homebrew/list.shLibrary/Homebrew/test/cmd/list_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.
-
brew list --versions <formula>andbrew list --versions --formulastarted Ruby only to read directory names from the Cellar. Scripts often use the former to check whether formulae are installed.list.shnow prints these for plain formula names, sorted as Ruby sorts them, or for every formula when--formulais given or no casks are installed.--versionsand formulae with more than one version installed, which Ruby lists in directory order, still go to Ruby.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Opus 5.5 xhigh with manual review and testing.