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

ruby-changes:35893

From: usa <ko1@a...>
Date: Thu, 16 Oct 2014 16:24:02 +0900 (JST)
Subject: [ruby-changes:35893] usa:r47974 (ruby_2_0_0): merge revision(s) 46783: [Backport #6716]

usa	2014-10-16 16:23:46 +0900 (Thu, 16 Oct 2014)

  New Revision: 47974

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

  Log:
    merge revision(s) 46783: [Backport #6716]
    
    * lib/fileutils.rb: handle ENOENT error with symlink targeted to
      non-exists file. [ruby-dev:45933] [Bug #6716]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/fileutils.rb
    branches/ruby_2_0_0/test/fileutils/test_fileutils.rb
    branches/ruby_2_0_0/version.h
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 47973)
+++ ruby_2_0_0/ChangeLog	(revision 47974)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Thu Oct 16 16:23:03 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* lib/fileutils.rb: handle ENOENT error with symlink targeted to
+	  non-exists file. [ruby-dev:45933] [Bug #6716]
+
 Wed Oct 15 16:23:22 2014  Tanaka Akira  <akr@f...>
 
 	* test/ruby/test_time_tz.rb: Fix test error with tzdata-2014g.
Index: ruby_2_0_0/lib/fileutils.rb
===================================================================
--- ruby_2_0_0/lib/fileutils.rb	(revision 47973)
+++ ruby_2_0_0/lib/fileutils.rb	(revision 47974)
@@ -848,7 +848,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/fileutils.rb#L848
     fu_check_options options, OPT_TABLE['install']
     fu_output_message "install -c#{options[:preserve] && ' -p'}#{options[:mode] ? (' -m 0%o' % options[:mode]) : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
     return if options[:noop]
-    fu_each_src_dest(src, dest) do |s, d, st|
+    fu_each_src_dest(src, dest) do |s, d|
+      st = File.stat(s)
       unless File.exist?(d) and compare_file(s, d)
         remove_file d, true
         copy_file s, d
@@ -1231,7 +1232,12 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/fileutils.rb#L1232
     end
 
     def exist?
-      lstat! ? true : false
+      begin
+        lstat
+        true
+      rescue Errno::ENOENT
+        false
+      end
     end
 
     def file?
@@ -1549,7 +1555,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/fileutils.rb#L1555
   def fu_each_src_dest(src, dest)   #:nodoc:
     fu_each_src_dest0(src, dest) do |s, d|
       raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s, d)
-      yield s, d, File.stat(s)
+      yield s, d
     end
   end
   private_module_function :fu_each_src_dest
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 47973)
+++ ruby_2_0_0/version.h	(revision 47974)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2014-10-15"
-#define RUBY_PATCHLEVEL 585
+#define RUBY_RELEASE_DATE "2014-10-16"
+#define RUBY_PATCHLEVEL 586
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 10
-#define RUBY_RELEASE_DAY 15
+#define RUBY_RELEASE_DAY 16
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/fileutils/test_fileutils.rb
===================================================================
--- ruby_2_0_0/test/fileutils/test_fileutils.rb	(revision 47973)
+++ ruby_2_0_0/test/fileutils/test_fileutils.rb	(revision 47974)
@@ -411,6 +411,12 @@ class TestFileUtils https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/fileutils/test_fileutils.rb#L411
     assert_raise(Errno::ELOOP) {
       mv 'tmp/symlink', 'tmp/symlink'
     }
+    # unexist symlink
+    File.symlink 'xxx', 'tmp/src'
+    assert_nothing_raised {
+      mv 'tmp/src', 'tmp/dest'
+    }
+    assert_equal true, File.symlink?('tmp/dest')
   end if have_symlink?
 
   def test_mv_pathname

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r46783


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

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