ruby-changes:38724
From: usa <ko1@a...>
Date: Tue, 9 Jun 2015 16:16:45 +0900 (JST)
Subject: [ruby-changes:38724] usa:r50805 (ruby_2_1): merge revision(s) 50515: [Backport #11155]
usa 2015-06-09 16:16:31 +0900 (Tue, 09 Jun 2015) New Revision: 50805 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50805 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_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/load.c branches/ruby_2_1/test/ruby/test_autoload.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 50804) +++ ruby_2_1/ChangeLog (revision 50805) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Tue Jun 9 16:15:31 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 + Fri May 29 14:03:33 2015 Matt Hoyle <matt@d...> * ext/bigdecimal/bigdecimal.c (VpSetPTR): fix a typo, 'expoennt' Index: ruby_2_1/load.c =================================================================== --- ruby_2_1/load.c (revision 50804) +++ ruby_2_1/load.c (revision 50805) @@ -319,7 +319,7 @@ loaded_feature_path(const char *name, lo https://github.com/ruby/ruby/blob/trunk/ruby_2_1/load.c#L319 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_1/version.h =================================================================== --- ruby_2_1/version.h (revision 50804) +++ ruby_2_1/version.h (revision 50805) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.7" -#define RUBY_RELEASE_DATE "2015-05-29" -#define RUBY_PATCHLEVEL 362 +#define RUBY_RELEASE_DATE "2015-06-09" +#define RUBY_PATCHLEVEL 363 #define RUBY_RELEASE_YEAR 2015 -#define RUBY_RELEASE_MONTH 5 -#define RUBY_RELEASE_DAY 29 +#define RUBY_RELEASE_MONTH 6 +#define RUBY_RELEASE_DAY 9 #include "ruby/version.h" Index: ruby_2_1/test/ruby/test_autoload.rb =================================================================== --- ruby_2_1/test/ruby/test_autoload.rb (revision 50804) +++ ruby_2_1/test/ruby/test_autoload.rb (revision 50805) @@ -56,6 +56,32 @@ p Foo::Bar https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_autoload.rb#L56 } 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_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r50515 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/