[前][次][番号順一覧][スレッド一覧]

ruby-changes:44479

From: nobu <ko1@a...>
Date: Fri, 4 Nov 2016 10:35:56 +0900 (JST)
Subject: [ruby-changes:44479] nobu:r56551 (trunk): fileutils.rb: fix error for non-existent entry

nobu	2016-11-04 10:35:49 +0900 (Fri, 04 Nov 2016)

  New Revision: 56551

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56551

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/lib/fileutils.rb
    trunk/test/fileutils/test_fileutils.rb
Index: lib/fileutils.rb
===================================================================
--- lib/fileutils.rb	(revision 56550)
+++ lib/fileutils.rb	(revision 56551)
@@ -1244,6 +1244,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1244
     end
 
     def copy(dest)
+      lstat
       case
       when file?
         copy_file dest
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56550)
+++ ChangeLog	(revision 56551)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Nov  4 10:35:47 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@m...>
 
 	* ext/bigdecimal/bigdecimal.c: Import changes from ruby/bigdecimal
Index: test/fileutils/test_fileutils.rb
===================================================================
--- test/fileutils/test_fileutils.rb	(revision 56550)
+++ test/fileutils/test_fileutils.rb	(revision 56551)
@@ -361,6 +361,11 @@ class TestFileUtils < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/fileutils/test_fileutils.rb#L361
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]