ruby-changes:57977
From: Jeremy <ko1@a...>
Date: Fri, 27 Sep 2019 13:22:57 +0900 (JST)
Subject: [ruby-changes:57977] 06c35cfa65 (master): [ruby/fileutils] Fix cp_r with symlink root on Windows
https://git.ruby-lang.org/ruby.git/commit/?id=06c35cfa65 From 06c35cfa65ed5e023bb8b82af93a3d711e550913 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Fri, 23 Aug 2019 14:52:12 -0700 Subject: [ruby/fileutils] Fix cp_r with symlink root on Windows Previously this would copy the symlink root as a symlink instead of creating a new root directory. This modifies the source to expand it using File.realpath before starting the copy. Fixes Ruby Bug 12123 https://github.com/ruby/fileutils/commit/7359cef359 diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 3c23ffc..27524fc 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -488,7 +488,11 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L488 # If +remove_destination+ is true, this method removes each destination file before copy. # def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false) - Entry_.new(src, nil, dereference_root).wrap_traverse(proc do |ent| + if dereference_root + src = File.realpath(src) + end + + Entry_.new(src, nil, false).wrap_traverse(proc do |ent| destent = Entry_.new(dest, ent.rel, false) File.unlink destent.path if remove_destination && (File.file?(destent.path) || File.symlink?(destent.path)) ent.copy destent.path -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/