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

ruby-changes:19804

From: yugui <ko1@a...>
Date: Tue, 31 May 2011 11:12:46 +0900 (JST)
Subject: [ruby-changes:19804] yugui:r31849 (ruby_1_9_2): merges r30789 from trunk into ruby_1_9_2. Fixes #4446.

yugui	2011-05-31 11:12:33 +0900 (Tue, 31 May 2011)

  New Revision: 31849

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

  Log:
    merges r30789 from trunk into ruby_1_9_2. Fixes #4446.
    --
    * load.c (rb_get_expanded_load_path): always expand load paths.

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/load.c
    branches/ruby_1_9_2/test/ruby/test_autoload.rb
    branches/ruby_1_9_2/version.h

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 31848)
+++ ruby_1_9_2/ChangeLog	(revision 31849)
@@ -1,3 +1,7 @@
+Sat Feb  5 10:09:31 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* load.c (rb_get_expanded_load_path): always expand load paths.
+
 Tue Jul  6 22:57:21 2010  Tanaka Akira  <akr@f...>
 
 	* io.c (nogvl_copy_stream_sendfile): jump to retry_sendfile directly
Index: ruby_1_9_2/load.c
===================================================================
--- ruby_1_9_2/load.c	(revision 31848)
+++ ruby_1_9_2/load.c	(revision 31849)
@@ -40,14 +40,6 @@
     VALUE ary;
     long i;
 
-    for (i = 0; i < RARRAY_LEN(load_path); ++i) {
-	VALUE str = rb_check_string_type(RARRAY_PTR(load_path)[i]);
-	if (NIL_P(str) || !rb_is_absolute_path(RSTRING_PTR(str)))
-	    goto relative_path_found;
-    }
-    return load_path;
-
-  relative_path_found:
     ary = rb_ary_new2(RARRAY_LEN(load_path));
     for (i = 0; i < RARRAY_LEN(load_path); ++i) {
 	VALUE path = rb_file_expand_path(RARRAY_PTR(load_path)[i], Qnil);
Index: ruby_1_9_2/version.h
===================================================================
--- ruby_1_9_2/version.h	(revision 31848)
+++ ruby_1_9_2/version.h	(revision 31849)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 264
+#define RUBY_PATCHLEVEL 265
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_2/test/ruby/test_autoload.rb
===================================================================
--- ruby_1_9_2/test/ruby/test_autoload.rb	(revision 31848)
+++ ruby_1_9_2/test/ruby/test_autoload.rb	(revision 31849)
@@ -9,4 +9,29 @@
     begin Continuation; rescue LoadError; end
     INPUT
   end
+
+  def test_non_realpath_in_loadpath
+    require 'tmpdir'
+    tmpdir = Dir.mktmpdir('autoload')
+    tmpdirs = [tmpdir]
+    tmpdirs.unshift(tmpdir + '/foo')
+    Dir.mkdir(tmpdirs[0])
+    tmpfiles = [tmpdir + '/foo.rb', tmpdir + '/foo/bar.rb']
+    open(tmpfiles[0] , 'w') do |f|
+      f.puts <<-INPUT
+$:.unshift(File.expand_path('..', __FILE__)+'/./foo')
+module Foo
+  autoload :Bar, 'bar'
 end
+Foo::Bar
+      INPUT
+    end
+    open(tmpfiles[1], 'w') do |f|
+      f.puts 'class Foo::Bar; end'
+    end
+    assert_in_out_err([tmpfiles[0]], "", [], [])
+  ensure
+    File.unlink(*tmpfiles) rescue nil if tmpfiles
+    tmpdirs.each {|dir| Dir.rmdir(dir)}
+  end
+end

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

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