ruby-changes:16243
From: shyouhei <ko1@a...>
Date: Tue, 8 Jun 2010 15:30:45 +0900 (JST)
Subject: [ruby-changes:16243] Ruby:r28210 (ruby_1_8_7): merge revision(s) 27398:
shyouhei 2010-06-08 15:30:35 +0900 (Tue, 08 Jun 2010) New Revision: 28210 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28210 Log: merge revision(s) 27398: * eval.c (search_required): expand home relative path first. [ruby-core:29610] Added files: branches/ruby_1_8_7/test/ruby/test_require.rb Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/eval.c branches/ruby_1_8_7/version.h Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 28209) +++ ruby_1_8_7/ChangeLog (revision 28210) @@ -1,3 +1,8 @@ +Tue Jun 8 15:27:00 2010 Nobuyoshi Nakada <nobu@r...> + + * eval.c (search_required): expand home relative path first. + [ruby-core:29610] + Tue Jun 8 15:23:10 2010 Nobuyoshi Nakada <nobu@r...> * lib/timeout.rb (Timeout#timeout): propagate errors to the Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 28209) +++ ruby_1_8_7/version.h (revision 28210) @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2010-06-08" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20100608 -#define RUBY_PATCHLEVEL 274 +#define RUBY_PATCHLEVEL 275 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 Index: ruby_1_8_7/test/ruby/test_require.rb =================================================================== --- ruby_1_8_7/test/ruby/test_require.rb (revision 0) +++ ruby_1_8_7/test/ruby/test_require.rb (revision 28210) @@ -0,0 +1,27 @@ +require 'test/unit' + +require 'tempfile' +require File.expand_path('../envutil', __FILE__) +require 'tmpdir' + +class TestRequire < Test::Unit::TestCase + def test_home_path + home = ENV["HOME"] + bug3171 = '[ruby-core:29610]' + Dir.mktmpdir do |tmp| + ENV["HOME"] = tmp + name = "loadtest#{$$}-1" + path = File.join(tmp, name) << ".rb" + open(path, "w") {} + require "~/#{name}" + assert_equal(path, $"[-1], bug3171) + name.succ! + path = File.join(tmp, name << ".rb") + open(path, "w") {} + require "~/#{name}" + assert_equal(path, $"[-1], bug3171) + end + ensure + ENV["HOME"] = home + end +end Property changes on: ruby_1_8_7/test/ruby/test_require.rb ___________________________________________________________________ Name: svn:eol-style + LF Index: ruby_1_8_7/eval.c =================================================================== --- ruby_1_8_7/eval.c (revision 28209) +++ ruby_1_8_7/eval.c (revision 28210) @@ -7328,9 +7328,13 @@ const char *ext, *ftptr; int type; + if (*(ftptr = RSTRING_PTR(fname)) == '~') { + fname = rb_file_expand_path(fname, Qnil); + ftptr = RSTRING_PTR(fname); + } *featurep = fname; *path = 0; - ext = strrchr(ftptr = RSTRING_PTR(fname), '.'); + ext = strrchr(ftptr, '.'); if (ext && !strchr(ext, '/')) { if (strcmp(".rb", ext) == 0) { if (rb_feature_p(ftptr, ext, Qtrue)) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/