Merge pull request #15707 from carlocab/more-dupe-rpath-handling

os/mac/keg_relocate: avoid changing to an already existing rpath
This commit is contained in:
Mike McQuaid 2023-07-18 14:26:17 +01:00 committed by GitHub
commit f195b24335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,7 +62,15 @@ class Keg
else
new_name = opt_name_for(bad_name)
loader_name = loader_name_for(file, new_name)
change_rpath(bad_name, loader_name, file) if loader_name != bad_name
next if loader_name == bad_name
if file.rpaths(resolve_variable_references: false).include?(loader_name)
# The wanted loader_name is already an rpath, so the existing bad_name is not needed.
# Attempting to change bad_name to an already existing rpath will produce an error.
delete_rpath(bad_name, file)
else
change_rpath(bad_name, loader_name, file)
end
end
end
end