Check raw linkage names when bottling - #23646
Conversation
|
Thanks for your pull request. This has been closed because it appears to be missing the pull request template, perhaps because this was written by an AI not a human. We require humans to read and fill in these templates. Please edit this pull request to fill in the current pull request template. This workflow will reopen this pull request automatically once the template is complete. Do not open a new pull request for this. |
There was a problem hiding this comment.
Pull request overview
This PR fixes brew bottle鈥檚 relocatability checker on arm64 macOS by ensuring Mach-O linkage is evaluated using the raw load-command names (without resolving @rpath / @loader_path against the live keg), preventing relocatable-by-construction linkage from being misinterpreted as absolute build-prefix paths and incorrectly pinning bottles.
Changes:
- Update macOS
Keg.file_linked_librariesto calldynamically_linked_libraries(resolve_variable_references: false)so the checker inspects raw load-command names. - Add an RSpec example verifying raw (unresolved) linkage names are used for the linkage check.
- Update the relocatable-bottles plan and
AGENTS.mdwith clarifications based on the resolvedabseilpinning root cause and contribution workflow guidance.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Library/Homebrew/extend/os/mac/keg_relocate.rb | Switch linkage checking to raw load-command names to avoid false pinning from resolved @rpath/@loader_path. |
| Library/Homebrew/test/os/mac/keg_spec.rb | Add a spec to assert linkage checking does not resolve variable references. |
| Library/Homebrew/plans/relocatable-bottles.md | Document the resolved checker divergence/root cause and update the Phase 1 plan item accordingly. |
| AGENTS.md | Add a contribution instruction to always use the PR template rather than bypassing it. |
馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
beab001 to
27dafcd
Compare
fa01909 to
08ab0b0
Compare
08ab0b0 to
461555b
Compare
461555b to
a82cc74
Compare
a82cc74 to
bf4d296
Compare
bf4d296 to
9b910e8
Compare
- `brew bottle`'s relocatability checker resolved `@rpath` and `@loader_path` load commands against the live keg, so relocatable-by-construction linkage read back as absolute build-prefix paths and wrongly pinned bottles to their build cellar. - Verified against the fresh `abseil` rebuild: its googletest helper dylibs carry `/opt/homebrew/include/gtest/...` assertion strings that select the files for checking (while the `ignores` filters drop every text match, leaving `binary_relocation_files` empty), after which their `@rpath/libabsl_*.dylib` load commands resolved through `LC_RPATH @loader_path` to the keg's absolute path and pinned the bottle. Only arm64 macOS was affected: `/usr/local/include/...` never byte-matches Intel's `/usr/local/opt` and `/usr/local/Cellar` search strings and Linux performs no linkage check. - The checker now reads raw load-command names. Raw names lose no true positives: a genuinely unplaceholdered name or RPATH contains the prefix in its raw bytes and is already caught. - 127 formulae are pinned on all arm64 macOS tags yet `cellar :any` on `x86_64_linux` (e.g. `abseil`, `boost`, `binutils`, `aws-sdk-cpp`); once this fix reaches CI they can be re-marked or will flip on rebottle. This change is part of [`plans/relocatable-bottles.md`](https://github.com/Homebrew/brew/blob/HEAD/Library/Homebrew/plans/relocatable-bottles.md)
- `gh pr create --fill` copies the commit message into the pull request body, silently bypassing the checklist and structure in `.github/PULL_REQUEST_TEMPLATE.md`, so require the template in `AGENTS.md` and the relocatable bottles plan. This change is part of [`plans/relocatable-bottles.md`](https://github.com/Homebrew/brew/blob/HEAD/Library/Homebrew/plans/relocatable-bottles.md)
9b910e8 to
f6d9f05
Compare
brew bottle's relocatability checker resolved@rpathand@loader_pathload commands against the live keg, sorelocatable-by-construction linkage read back as absolute
build-prefix paths and wrongly pinned bottles to their build cellar.
abseilrebuild: its googletest helperdylibs carry
/opt/homebrew/include/gtest/...assertion stringsthat select the files for checking (while the
ignoresfiltersdrop every text match, leaving
binary_relocation_filesempty),after which their
@rpath/libabsl_*.dylibload commands resolvedthrough
LC_RPATH @loader_pathto the keg's absolute path andpinned the bottle. Only arm64 macOS was affected:
/usr/local/include/...never byte-matches Intel's/usr/local/optand/usr/local/Cellarsearch strings and Linuxperforms no linkage check.
true positives: a genuinely unplaceholdered name or RPATH contains
the prefix in its raw bytes and is already caught.
cellar :anyon
x86_64_linux(e.g.abseil,boost,binutils,aws-sdk-cpp); once this fix reaches CI they can be re-marked orwill flip on rebottle.
This change is part of
plans/relocatable-bottles.mdbrew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Fable 5 with local review and testing.