Skip to content

keg: fix any_skip_relocation cellar on Linux#22441

Merged
MikeMcQuaid merged 1 commit into
mainfrom
linux-skip-relocation
May 29, 2026
Merged

keg: fix any_skip_relocation cellar on Linux#22441
MikeMcQuaid merged 1 commit into
mainfrom
linux-skip-relocation

Conversation

@cho-m
Copy link
Copy Markdown
Member

@cho-m cho-m commented May 28, 2026


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR.

On Linux, :any_skip_relocation vs :any detection has been historically broken which is why we've ignored the value.

def skip_relocation?(tag: Utils::Bottles.tag)
false
end

This PR tries to fix the actual cellar symbol used.

It does not fix the above skip_relocation? check yet. Thinking of fixing a few bottles first and using those to test this part later on. Will likely need to access tab information to check parsed_homebrew_version aligned to next release (e.g. >= 5.1.15).


Ran a few local checks on formulae via brew install --build-bottle and brew bottle:

  • snappy - should be any bottle but currently isn't https://github.com/Homebrew/homebrew-core/blob/main/Formula/s/snappy.rb#L17-L18. Local test outputs:

        sha256 cellar: :any, arm64_linux: "3932df8110e3267ed98d0ae0ed335123dc971a9a5d3603c0617babe0341f8383"
    
        sha256 cellar: :any, arm64_tahoe: "61056dfcc56bd23496be6f12eb041bbd91e653dd507e32712adbcf25fa698595"
    
  • fx - checking no regression on any_skip_relocation

        sha256 cellar: :any_skip_relocation, arm64_linux: "8350dd22443c51fc0fcff34c2c6ae1c2751650f11464b2b4336bdf93525733f1"
    
        sha256 cellar: :any_skip_relocation, arm64_tahoe: "0a04f691be96462647f02090a624c1d1b933f4b08d8873fd57f4d22493b2e2ba"
    
  • libfaketime - checking no regression on non-relocatable

        sha256 arm64_linux: "6767394bc1f6b5823884957d6aee9d18f386705d53c12aa3654c5599eb43275e"
    
        sha256 arm64_tahoe: "e8b25817117c07f425b89871f6fe9179db9969998f076ece777413fc0ec9526c"
    

Not sure if our tests cover any of this yet.

@cho-m cho-m force-pushed the linux-skip-relocation branch from b1b5138 to a149f5c Compare May 28, 2026 20:28
@cho-m cho-m changed the title keg: fix any_skip_relocation cellar keg: fix any_skip_relocation cellar on Linux May 28, 2026
@cho-m cho-m marked this pull request as ready for review May 28, 2026 20:35
Copilot AI review requested due to automatic review settings May 28, 2026 20:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes Linux bottle cellar selection for :any_skip_relocation vs :any by properly tracking when a keg actually required binary relocation, aligning the skip_relocation decision in brew bottle with real ELF patching activity.

Changes:

  • Add a typed @require_relocation flag to Keg and introduce a require_relocation! setter.
  • Use require_relocation! in macOS Mach-O relocation helpers instead of directly mutating the ivar.
  • On Linux, mark relocation as required when ELF rpath/interpreter patching occurs (and avoid reporting relocation when no changes are made).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/keg.rb Types @require_relocation and adds require_relocation! to centralize relocation state changes.
Library/Homebrew/extend/os/mac/keg.rb Switches Mach-O change helpers to call require_relocation! instead of setting the ivar directly.
Library/Homebrew/extend/os/linux/keg_relocate.rb Sets relocation-required state when ELF patching happens, improving :any vs :any_skip_relocation detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/extend/os/linux/keg_relocate.rb
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks!

@MikeMcQuaid MikeMcQuaid enabled auto-merge May 29, 2026 07:19
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 29, 2026
Merged via the queue into main with commit 04366fc May 29, 2026
45 checks passed
@MikeMcQuaid MikeMcQuaid deleted the linux-skip-relocation branch May 29, 2026 07:34
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