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

ruby-changes:38754

From: nagachika <ko1@a...>
Date: Fri, 12 Jun 2015 01:12:51 +0900 (JST)
Subject: [ruby-changes:38754] nagachika:r50835 (ruby_2_2): merge revision(s) 50515: [Backport #11155]

nagachika	2015-06-12 01:12:29 +0900 (Fri, 12 Jun 2015)

  New Revision: 50835

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

  Log:
    merge revision(s) 50515: [Backport #11155]
    
    * load.c (loaded_feature_path): stop returning false negatives for
      filenames which are trailing substrings of file extensions.  For
      example, 'b', which a trailing substring of ".rb" should not return
      false. [Bug #11155][ruby-core:69206]
    
    * test/ruby/test_autoload.rb: test for fix

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/load.c
    branches/ruby_2_2/test/ruby/test_autoload.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 50834)
+++ ruby_2_2/ChangeLog	(revision 50835)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Fri Jun 12 01:11:52 2015  Aaron Patterson <tenderlove@r...>
+
+	* load.c (loaded_feature_path): stop returning false negatives for
+	  filenames which are trailing substrings of file extensions.  For
+	  example, 'b', which a trailing substring of ".rb" should not return
+	  false. [Bug #11155][ruby-core:69206]
+
+	* test/ruby/test_autoload.rb: test for fix
+
 Sun May 24 03:56:27 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* marshal.c (r_symreal): register symbol names as strings first so
Index: ruby_2_2/load.c
===================================================================
--- ruby_2_2/load.c	(revision 50834)
+++ ruby_2_2/load.c	(revision 50835)
@@ -318,7 +318,7 @@ loaded_feature_path(const char *name, lo https://github.com/ruby/ruby/blob/trunk/ruby_2_2/load.c#L318
     const char *e;
 
     if (vlen < len+1) return 0;
-    if (!strncmp(name+(vlen-len), feature, len)) {
+    if (strchr(feature, '.') && !strncmp(name+(vlen-len), feature, len)) {
 	plen = vlen - len;
     }
     else {
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 50834)
+++ ruby_2_2/version.h	(revision 50835)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
-#define RUBY_RELEASE_DATE "2015-05-24"
-#define RUBY_PATCHLEVEL 129
+#define RUBY_RELEASE_DATE "2015-06-12"
+#define RUBY_PATCHLEVEL 130
 
 #define RUBY_RELEASE_YEAR 2015
-#define RUBY_RELEASE_MONTH 5
-#define RUBY_RELEASE_DAY 24
+#define RUBY_RELEASE_MONTH 6
+#define RUBY_RELEASE_DAY 12
 
 #include "ruby/version.h"
 
Index: ruby_2_2/test/ruby/test_autoload.rb
===================================================================
--- ruby_2_2/test/ruby/test_autoload.rb	(revision 50834)
+++ ruby_2_2/test/ruby/test_autoload.rb	(revision 50835)
@@ -55,6 +55,32 @@ p Foo::Bar https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_autoload.rb#L55
     }
   end
 
+  def test_autoload_with_unqualified_file_name # [ruby-core:69206]
+    lp = $LOAD_PATH.dup
+    lf = $LOADED_FEATURES.dup
+
+    Dir.mktmpdir('autoload') { |tmpdir|
+      $LOAD_PATH << tmpdir
+
+      Dir.chdir(tmpdir) do
+        eval <<-END
+          class ::Object
+            module A
+              autoload :C, 'b'
+            end
+          end
+        END
+
+        File.open('b.rb', 'w') {|file| file.puts 'module A; class C; end; end'}
+        assert_kind_of Class, ::A::C
+      end
+    }
+  ensure
+    $LOAD_PATH.replace lp
+    $LOADED_FEATURES.replace lf
+    Object.send(:remove_const, :A) if Object.const_defined?(:A)
+  end
+
   def test_require_explicit
     Tempfile.create(['autoload', '.rb']) {|file|
       file.puts 'class Object; AutoloadTest = 1; end'

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r50515


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

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