diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-12 08:24:33 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-12 08:24:33 +0000 |
commit | 9835b48a385c7f6663945a325d2165a1c07cc3a9 (patch) | |
tree | b196a411fca8622470976f600c6c2e77d0086fc1 | |
parent | c0e208bc397f5a61611affe06ce4ce4bbdb47984 (diff) |
merge revision(s) 53346,53347,53348,53349: [Backport #11898]
* process.c: use rb_w32_uchdir() instead of plain chdir() on Windows.
reported by naruse via twitter.
* process.c (rb_execarg_addopt): need to convert to ospath.
* process.c (rb_execarg_parent_start1): need to convert the encoding to
ospath's one.
* process.c (rb_execarg_addopt): need to convert the encoding to
ospath's one.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@53508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | process.c | 7 | ||||
-rw-r--r-- | test/ruby/test_process.rb | 10 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 31 insertions, 1 deletions
@@ -1,3 +1,16 @@ +Tue Jan 12 17:23:39 2016 NAKAMURA Usaku <usa@ruby-lang.org> + + * process.c (rb_execarg_parent_start1): need to convert the encoding to + ospath's one. + +Tue Jan 12 17:23:39 2016 NAKAMURA Usaku <usa@ruby-lang.org> + + * process.c: use rb_w32_uchdir() instead of plain chdir() on Windows. + reported by naruse via twitter. + + * process.c (rb_execarg_addopt): need to convert the encoding to + ospath's one. + Tue Jan 12 15:21:00 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> * include/ruby/missing.h (explicit_bzero_by_memset_s): remove @@ -1713,6 +1713,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val) rb_raise(rb_eArgError, "chdir option specified twice"); } FilePathValue(val); + val = rb_str_encode_ospath(val); eargp->chdir_given = 1; eargp->chdir_dir = hide_obj(EXPORT_DUP(val)); } @@ -2313,6 +2314,7 @@ rb_execarg_parent_start1(VALUE execarg_obj) if (NIL_P(fd2v)) { struct open_struct open_data; FilePathValue(vpath); + vpath = rb_str_encode_ospath(vpath); again: open_data.fname = vpath; open_data.oflags = flags; @@ -2967,6 +2969,11 @@ save_env(struct rb_execarg *sargp) } #endif +#ifdef _WIN32 +#undef chdir +#define chdir(p) rb_w32_uchdir(p) +#endif + /* This function should be async-signal-safe when sargp is NULL. Hopefully it is. */ int rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen) diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index ca35d151a9..c8b4b7d343 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -425,6 +425,16 @@ class TestProcess < Test::Unit::TestCase } end + def test_execopts_open_chdir_m17n_path + with_tmpchdir {|d| + Dir.mkdir "テスト" + system(*PWD, :chdir => "テスト", :out => "open_chdir_テスト") + assert_file.exist?("open_chdir_テスト") + assert_file.not_exist?("テスト/open_chdir_テスト") + assert_equal("#{d}/テスト", File.read("open_chdir_テスト").chomp.encode(__ENCODING__)) + } + end + def test_execopts_open_failure with_tmpchdir {|d| assert_raise_with_message(Errno::ENOENT, %r"d/notexist") { @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.3.0" #define RUBY_RELEASE_DATE "2016-01-12" -#define RUBY_PATCHLEVEL 3 +#define RUBY_PATCHLEVEL 4 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 1 |