From 6457770a59273c03b07f5235902640b393c8e452 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera Date: Wed, 13 Aug 2025 00:25:53 +0800 Subject: [PATCH] os/linux/keg_relocate: skip ELF files with `protodesc_cold` only when bottling We removed this exclusion in #20423 because it broke pouring of existing bottles, which still need relocation. Let's skip relocation only when bottling, to avoid breaking existing bottles that need to be relocated when pouring. --- Library/Homebrew/extend/os/linux/keg_relocate.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Library/Homebrew/extend/os/linux/keg_relocate.rb b/Library/Homebrew/extend/os/linux/keg_relocate.rb index 42e32dbf65..a702d6be79 100644 --- a/Library/Homebrew/extend/os/linux/keg_relocate.rb +++ b/Library/Homebrew/extend/os/linux/keg_relocate.rb @@ -20,6 +20,13 @@ class Keg def change_rpath!(file, old_prefix, new_prefix) return false if !file.elf? || !file.dynamic_elf? + bottling = old_prefix.to_s.start_with?(HOMEBREW_PREFIX.to_s) + bottling &&= !new_prefix.to_s.start_with?(HOMEBREW_PREFIX.to_s) + # Skip relocation of files with `protodesc_cold` sections because patchelf.rb seems to break them, + # but only when bottling (as we don't want to break existing bottles that require relocation). + # https://github.com/Homebrew/homebrew-core/pull/232490#issuecomment-3161362452 + return false if bottling && file.section_names.include?("protodesc_cold") + updated = {} old_rpath = file.rpath new_rpath = if old_rpath