aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/pathname.rb
diff options
context:
space:
mode:
authorJack Nagel2014-07-10 15:39:55 -0500
committerJack Nagel2014-07-10 15:39:55 -0500
commit9d799f152a18adb5933eb50eb2a6ec2f0ae275ee (patch)
tree565cd94c5ffd48c2bffe86e71f41f26da8e68a8e /Library/Homebrew/extend/pathname.rb
parentd6fd4dbb93d55a6f7951efd48a75432179464f9d (diff)
downloadhomebrew-9d799f152a18adb5933eb50eb2a6ec2f0ae275ee.tar.bz2
Make comment in Pathname#install more accurate
Diffstat (limited to 'Library/Homebrew/extend/pathname.rb')
-rw-r--r--Library/Homebrew/extend/pathname.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index d38b6b2cd..fdf5395c9 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