From 2e86a92b3c9153bc5bc47e5684ab3ace70d824ae Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 5 Sep 2014 05:05:42 +0000 Subject: [PATCH] merge revision(s) 46441: [Backport #9946] * process.c (open): use UTF-8 version function to support non-ascii path properly. [ruby-core:63185] [Bug #9946] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@47404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ process.c | 6 ++++++ test/ruby/test_process.rb | 10 ++++++++++ version.h | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index abfb5ef9e0..b34ef11905 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Sep 5 14:00:33 2014 Nobuyoshi Nakada + + * process.c (open): use UTF-8 version function to support + non-ascii path properly. [ruby-core:63185] [Bug #9946] + Fri Sep 5 13:53:41 2014 Nobuyoshi Nakada * parse.y (parser_yylex): fix invalid char in eval, should raise diff --git a/process.c b/process.c index b7b4325e56..458c862f4f 100644 --- a/process.c +++ b/process.c @@ -82,6 +82,12 @@ #define numberof(array) (int)(sizeof(array)/sizeof((array)[0])) +/* define system APIs */ +#ifdef _WIN32 +#undef open +#define open rb_w32_uopen +#endif + #if defined(HAVE_TIMES) || defined(_WIN32) static VALUE rb_cProcessTms; #endif diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index c760e8ebda..8b79d35738 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -602,6 +602,16 @@ class TestProcess < Test::Unit::TestCase } end + def test_execopts_redirect_nonascii_path + bug9946 = '[ruby-core:63185] [Bug #9946]' + with_tmpchdir {|d| + path = "t-\u{30c6 30b9 30c8 f6}.txt" + system(*ECHO["a"], out: path) + assert_file.for(bug9946).exist?(path) + assert_equal("a\n", File.read(path), bug9946) + } + end + def test_execopts_redirect_dup2_child with_tmpchdir {|d| Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", diff --git a/version.h b/version.h index 9626af4114..c61d2346b9 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2014-09-05" -#define RUBY_PATCHLEVEL 553 +#define RUBY_PATCHLEVEL 554 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 9