aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorWilliam Woodruff2016-06-24 21:27:52 -0400
committerMartin Afanasjew2016-06-29 14:34:08 +0200
commitd3ef56425a6b4c190317c2527137b97c0ff5daf8 (patch)
tree80607d2a902b4601270325c956bcb58c56674f25 /Library
parentd4f5f0cec768df07f813aee1e5df2c687a0ad186 (diff)
downloadbrew-d3ef56425a6b4c190317c2527137b97c0ff5daf8.tar.bz2
keg_relocate: Exclude hardlinks from mach_o_files.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg_relocate.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb
index b1a72f1ef..be41841f1 100644
--- a/Library/Homebrew/keg_relocate.rb
+++ b/Library/Homebrew/keg_relocate.rb
@@ -157,10 +157,15 @@ class Keg
end
def mach_o_files
+ hardlinks = Set.new
mach_o_files = []
path.find do |pn|
next if pn.symlink? || pn.directory?
- mach_o_files << pn if pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable?
+ next unless pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable?
+ # if we've already processed a file, ignore its hardlinks (which have the same dev ID and inode)
+ # this prevents relocations from being performed on a binary more than once
+ next unless hardlinks.add? [pn.stat.dev, pn.stat.ino]
+ mach_o_files << pn
end
mach_o_files