From 284389a6bd4bf88269b4db580015e8590dd76a37 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Thu, 10 Jul 2014 15:39:55 -0500 Subject: [PATCH] Make comment in Pathname#install more accurate --- Library/Homebrew/extend/pathname.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index d38b6b2cd6..fdf5395c9a 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -45,22 +45,19 @@ class Pathname src = src.to_s dst = dst.to_s - # if it's a symlink, don't resolve it to a file because if we are moving - # files one by one, it's likely we will break the symlink by moving what - # it points to before we move it - # and also broken symlinks are not the end of the world raise "#{src} does not exist" unless File.symlink? src or File.exist? src dst = yield(src, dst) if block_given? mkpath + + # Use FileUtils.mv over File.rename to handle filesystem boundaries. If src + # is a symlink, and its target is moved first, FileUtils.mv will fail: + # https://bugs.ruby-lang.org/issues/7707 + # In that case, use the system "mv" command. if File.symlink? src - # we use the BSD mv command because FileUtils copies the target and - # not the link! I'm beginning to wish I'd used Python quite honestly! raise unless Kernel.system 'mv', src, dst else - # we mv when possible as it is faster and you should only be using - # this function when installing from the temporary build directory FileUtils.mv src, dst end end