Skip to content

keg_relocate: skip running patchelf on bun binaries - #23589

Merged
cho-m merged 1 commit into
mainfrom
skip-bun-relocation
Aug 20, 2026
Merged

keg_relocate: skip running patchelf on bun binaries#23589
cho-m merged 1 commit into
mainfrom
skip-bun-relocation

Conversation

@cho-m

@cho-m cho-m commented Aug 20, 2026

Copy link
Copy Markdown
Member

The .bun section needs to occur at a specific location. Upstream does support relocating interpreter (at least via NixOS/patchelf) but either patchelf.rb or RUNPATH relocation results in broken binary.

Was originally going to handle with

As wanted to check if newer bun helped, but looks like relocation doesn't work in 1.4.0 even after

Should still be easy to check locally in future if a patchelf.rb upgrade helps by undoing this skip and running brew install bun && brew bottle bun && brew test bun.

Also want to get this in before bun dependents start propagating gzip hack.


  • 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 Hyperfine benchmarks.
  • 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.

The `.bun` section needs to occur at a specific location. Upstream does
support relocating interpreter (at least via NixOS/patchelf) but either
patchelf.rb or RUNPATH relocation results in broken binary.
Copilot AI lite review requested due to automatic review settings August 20, 2026 18:27

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 adjusts Linux keg relocation so that bottling (placeholder relocation) skips running patchelf on ELF binaries that are known to be corrupted by it (specifically those containing a .bun section), while also renaming the internal relocation keyword to be broader than the previous skip_protodesc_cold flag.

Changes:

  • Rename the relocate_dynamic_linkage keyword from skip_protodesc_cold: to with_placeholders: across Keg relocation implementations.
  • On Linux, skip RPATH/interpreter relocation (and thus avoid invoking patchelf) for ELF files whose section list includes protodesc_cold or .bun when doing placeholder relocation.
  • Update the placeholder-relocation call site to pass the new keyword.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Library/Homebrew/keg_relocate.rb Renames the relocation keyword and updates the placeholder-relocation call site.
Library/Homebrew/extend/os/mac/keg_relocate.rb Keeps macOS override signature in sync with the renamed keyword (no behavioral change).
Library/Homebrew/extend/os/linux/keg_relocate.rb Adds the .bun-section skip (and refactors the skip flag) to avoid patchelf for affected binaries during bottling.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/keg_relocate.rb
Comment thread Library/Homebrew/extend/os/linux/keg_relocate.rb

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@cho-m
cho-m added this pull request to the merge queue Aug 20, 2026
@cho-m cho-m mentioned this pull request Aug 20, 2026
2 tasks
Merged via the queue into main with commit d5b0765 Aug 20, 2026
50 checks passed
@cho-m
cho-m deleted the skip-bun-relocation branch August 20, 2026 20:09
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.

4 participants