From e8b5eb7e42c925b7cc10c78a029b8c70e4d7965b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Mon, 17 May 2021 00:02:17 +0100 Subject: [PATCH] extend/os/mac/keg_relocate: fix relocation of duplicate `RPATH`s Homebrew/homebrew-core#77623 revealed two bugs. One in `ruby-macho`, which turns out to be unable to delete duplicated `RPATH`s. This was fixed with `ruby-macho` 2.5.1. The second, which this commit fixes, is in our handling of duplicate `RPATH`s. Since we iterate over each `RPATH`, attempting to relocate the first duplicate fails since it will no longer exist after having relocated the original. --- Library/Homebrew/extend/os/mac/keg_relocate.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index 729bbf968c..56cfbf68ce 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -94,6 +94,7 @@ class Keg def each_linkage_for(file, linkage_type, &block) links = file.method(linkage_type) .call + .uniq .reject { |fn| fn =~ /^@(loader_|executable_|r)path/ } links.each(&block) end