extend/os/mac/keg_relocate: fix relocation of duplicate RPATHs

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.
This commit is contained in:
Carlo Cabrera 2021-05-17 00:02:17 +01:00
parent 7ff63124e8
commit e8b5eb7e42
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -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