Skip to content

Check raw linkage names when bottling - #23646

Merged
MikeMcQuaid merged 2 commits into
node-gyp-debrisfrom
bottle-linkage-raw-names
Aug 26, 2026
Merged

Check raw linkage names when bottling#23646
MikeMcQuaid merged 2 commits into
node-gyp-debrisfrom
bottle-linkage-raw-names

Conversation

@MikeMcQuaid

@MikeMcQuaid MikeMcQuaid commented Aug 24, 2026

Copy link
Copy Markdown
Member
  • 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


  • 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 Fable 5 with local review and testing.


@github-actions

Copy link
Copy Markdown
Contributor

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.

Copilot AI 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.

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_libraries to call dynamically_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.md with clarifications based on the resolved abseil pinning 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.

Comment thread Library/Homebrew/test/os/mac/keg_spec.rb
@MikeMcQuaid
MikeMcQuaid force-pushed the bottle-linkage-raw-names branch from beab001 to 27dafcd Compare August 24, 2026 18:39
@MikeMcQuaid
MikeMcQuaid force-pushed the bottle-linkage-raw-names branch 2 times, most recently from fa01909 to 08ab0b0 Compare August 25, 2026 11:15
@MikeMcQuaid
MikeMcQuaid force-pushed the bottle-linkage-raw-names branch from 08ab0b0 to 461555b Compare August 25, 2026 11:17
@MikeMcQuaid
MikeMcQuaid force-pushed the bottle-linkage-raw-names branch from 461555b to a82cc74 Compare August 25, 2026 12:10
@MikeMcQuaid
MikeMcQuaid force-pushed the bottle-linkage-raw-names branch from a82cc74 to bf4d296 Compare August 25, 2026 14:55
@MikeMcQuaid
MikeMcQuaid force-pushed the bottle-linkage-raw-names branch from bf4d296 to 9b910e8 Compare August 25, 2026 18:17
- `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)
@MikeMcQuaid
MikeMcQuaid force-pushed the bottle-linkage-raw-names branch from 9b910e8 to f6d9f05 Compare August 26, 2026 16:48
@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit 89af474 Aug 26, 2026
63 of 75 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the bottle-linkage-raw-names branch August 26, 2026 18:23
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.

3 participants