From 94ebe8e747e774d7eb8efcb0e49c84581cc11bc6 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 4 Dec 2013 22:37:57 -0600 Subject: [PATCH] relocate_install_names: rewrite cellar names before prefix names The cellar may overlap with the prefix, so if we replace the prefix first, we will end up with paths like "@@HOMEBREW_PREFIX@@/Cellar" instead of "@@HOMEBREW_CELLAR@@", which will break on installations where the cellar and prefix are disjoint. --- Library/Homebrew/keg_fix_install_names.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index aa126228a7..3c46c1a2f8 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -18,6 +18,15 @@ class Keg def relocate_install_names old_prefix, new_prefix, old_cellar, new_cellar, options={} mach_o_files.each do |file| + install_names_for(file, options, relocate_reject_proc(old_cellar)) do |id, old_cellar_names| + file.ensure_writable do + old_cellar_names.each do |old_cellar_name| + new_cellar_name = old_cellar_name.to_s.gsub old_cellar, new_cellar + change_install_name(old_cellar_name, new_cellar_name, file) + end + end + end + install_names_for(file, options, relocate_reject_proc(old_prefix)) do |id, old_prefix_names| file.ensure_writable do new_prefix_id = id.to_s.gsub old_prefix, new_prefix @@ -29,15 +38,6 @@ class Keg end end end - - install_names_for(file, options, relocate_reject_proc(old_cellar)) do |id, old_cellar_names| - file.ensure_writable do - old_cellar_names.each do |old_cellar_name| - new_cellar_name = old_cellar_name.to_s.gsub old_cellar, new_cellar - change_install_name(old_cellar_name, new_cellar_name, file) - end - end - end end # Search for pkgconfig .pc files and relocate references to the cellar