Skip to content

Commit 42714f6

Browse files
committed
Ignore duplicate rpaths in #change_rpath
This causes a deviation in behaviour from `install_name_tool`, which will happily change an existing rpath to one that already exists. Closes #436.
1 parent bef44bb commit 42714f6

File tree

2 files changed

+0
-6
lines changed

2 files changed

+0
-6
lines changed

lib/macho/macho_file.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,9 @@ def rpaths
381381
# rpaths simultaneously.
382382
# @return [void]
383383
# @raise [RpathUnknownError] if no such old runtime path exists
384-
# @raise [RpathExistsError] if the new runtime path already exists
385384
def change_rpath(old_path, new_path, options = {})
386385
old_lc = command(:LC_RPATH).find { |r| r.path.to_s == old_path }
387386
raise RpathUnknownError, old_path if old_lc.nil?
388-
raise RpathExistsError, new_path if rpaths.include?(new_path)
389387

390388
new_lc = LoadCommands::LoadCommand.create(:LC_RPATH, new_path)
391389

test/test_macho.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,6 @@ def test_rpath_exceptions
574574
file.change_rpath("/this/rpath/doesn't/exist", "/lib")
575575
end
576576

577-
assert_raises MachO::RpathExistsError do
578-
file.change_rpath(file.rpaths.first, file.rpaths.first)
579-
end
580-
581577
assert_raises MachO::RpathExistsError do
582578
file.add_rpath(file.rpaths.first)
583579
end

0 commit comments

Comments
 (0)