ruby-changes:37285
From: nagachika <ko1@a...>
Date: Thu, 22 Jan 2015 00:39:14 +0900 (JST)
Subject: [ruby-changes:37285] nagachika:r49366 (ruby_2_1): merge revision(s) r48186: [Backport #10448]
nagachika 2015-01-22 00:38:57 +0900 (Thu, 22 Jan 2015) New Revision: 49366 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49366 Log: merge revision(s) r48186: [Backport #10448] * load.c (rb_f_load): path name needs to be transcoded to OS path encoding. [ruby-list:49994] 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_require.rb branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 49365) +++ ruby_2_1/ChangeLog (revision 49366) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Thu Jan 22 00:25:15 2015 Nobuyoshi Nakada <nobu@r...> + + * load.c (rb_f_load): path name needs to be transcoded to OS path + encoding. [ruby-list:49994] + Wed Jan 21 04:36:27 2015 Nobuyoshi Nakada <nobu@r...> * configure.in (NET_LUID): include winsock2.h instead of windows.h. Index: ruby_2_1/load.c =================================================================== --- ruby_2_1/load.c (revision 49365) +++ ruby_2_1/load.c (revision 49366) @@ -683,7 +683,7 @@ rb_load_protect(VALUE fname, int wrap, i https://github.com/ruby/ruby/blob/trunk/ruby_2_1/load.c#L683 static VALUE rb_f_load(int argc, VALUE *argv) { - VALUE fname, wrap, path; + VALUE fname, wrap, path, orig_fname; rb_scan_args(argc, argv, "11", &fname, &wrap); @@ -693,10 +693,12 @@ rb_f_load(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/load.c#L693 rb_sourceline()); } - path = rb_find_file(FilePathValue(fname)); + orig_fname = FilePathValue(fname); + fname = rb_str_encode_ospath(orig_fname); + path = rb_find_file(fname); if (!path) { if (!rb_file_load_ok(RSTRING_PTR(fname))) - load_failed(fname); + load_failed(orig_fname); path = fname; } rb_load_internal(path, RTEST(wrap)); Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 49365) +++ ruby_2_1/version.h (revision 49366) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.5" -#define RUBY_RELEASE_DATE "2015-01-21" -#define RUBY_PATCHLEVEL 279 +#define RUBY_RELEASE_DATE "2015-01-22" +#define RUBY_PATCHLEVEL 280 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 21 +#define RUBY_RELEASE_DAY 22 #include "ruby/version.h" Index: ruby_2_1/test/ruby/test_require.rb =================================================================== --- ruby_2_1/test/ruby/test_require.rb (revision 49365) +++ ruby_2_1/test/ruby/test_require.rb (revision 49366) @@ -307,6 +307,28 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_require.rb#L307 } end + def test_load_ospath + bug = '[ruby-list:49994] path in ospath' + base = "test_load\u{3042 3044 3046 3048 304a}".encode(Encoding::Windows_31J) + path = nil + Tempfile.create([base, ".rb"]) do |t| + path = t.path + + assert_raise_with_message(LoadError, /#{base}/) { + load(File.join(File.dirname(path), base)) + } + + t.puts "warn 'ok'" + t.close + assert_include(path, base) + assert_warn("ok\n", bug) { + assert_nothing_raised(LoadError, bug) { + load(path) + } + } + end + end + def test_tainted_loadpath Tempfile.create(["test_ruby_test_require", ".rb"]) {|t| abs_dir, file = File.split(t.path) Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r48186 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/