1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fileutils.rb: fix error for non-existent entry

* lib/fileutils.rb (FileUtils::Entry_#copy): ensure that the
  source entry exists first, to fix error for non-existent entry.
  [ruby-core:77885] [Bug #12892]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-11-04 01:35:49 +00:00
parent 03c9bc2b1d
commit 0785b3e1b7
3 changed files with 12 additions and 0 deletions

View file

@ -1,3 +1,9 @@
Fri Nov 4 10:35:47 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/fileutils.rb (FileUtils::Entry_#copy): ensure that the
source entry exists first, to fix error for non-existent entry.
[ruby-core:77885] [Bug #12892]
Thu Nov 3 21:45:00 2016 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c: Import changes from ruby/bigdecimal

View file

@ -1244,6 +1244,7 @@ module FileUtils
end
def copy(dest)
lstat
case
when file?
copy_file dest

View file

@ -361,6 +361,11 @@ class TestFileUtils < Test::Unit::TestCase
assert_raise(ArgumentError, bug3588) do
cp_r 'tmp2', 'tmp2/new_tmp2'
end
bug12892 = '[ruby-core:77885] [Bug #12892]'
assert_raise(Errno::ENOENT, bug12892) do
cp_r 'non/existent', 'tmp'
end
end
def test_cp_r_symlink