mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 17:14:01 +02:00
merge revision(s) 53346,53347,53348,53349,53391,53928: [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_2@54043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ebacc09894
commit
055c3336be
4 changed files with 35 additions and 4 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
Wed Mar 9 04:21:02 2016 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* process.c (rb_execarg_parent_start1): need to convert the encoding to
|
||||||
|
ospath's one.
|
||||||
|
|
||||||
|
Wed Mar 9 04:21:02 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.
|
||||||
|
|
||||||
Wed Mar 9 04:15:20 2016 Eric Wong <e@80x24.org>
|
Wed Mar 9 04:15:20 2016 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
* ext/stringio/stringio.c (strio_binmode): implement to set encoding
|
* ext/stringio/stringio.c (strio_binmode): implement to set encoding
|
||||||
|
|
14
process.c
14
process.c
|
@ -1737,6 +1737,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
|
||||||
rb_raise(rb_eArgError, "chdir option specified twice");
|
rb_raise(rb_eArgError, "chdir option specified twice");
|
||||||
}
|
}
|
||||||
FilePathValue(val);
|
FilePathValue(val);
|
||||||
|
val = rb_str_encode_ospath(val);
|
||||||
eargp->chdir_given = 1;
|
eargp->chdir_given = 1;
|
||||||
eargp->chdir_dir = hide_obj(EXPORT_DUP(val));
|
eargp->chdir_dir = hide_obj(EXPORT_DUP(val));
|
||||||
}
|
}
|
||||||
|
@ -2767,12 +2768,14 @@ run_exec_open(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_b
|
||||||
VALUE elt = RARRAY_AREF(ary, i);
|
VALUE elt = RARRAY_AREF(ary, i);
|
||||||
int fd = FIX2INT(RARRAY_AREF(elt, 0));
|
int fd = FIX2INT(RARRAY_AREF(elt, 0));
|
||||||
VALUE param = RARRAY_AREF(elt, 1);
|
VALUE param = RARRAY_AREF(elt, 1);
|
||||||
const VALUE vpath = RARRAY_AREF(param, 0);
|
VALUE vpath = RARRAY_AREF(param, 0);
|
||||||
const char *path = RSTRING_PTR(vpath);
|
|
||||||
int flags = NUM2INT(RARRAY_AREF(param, 1));
|
int flags = NUM2INT(RARRAY_AREF(param, 1));
|
||||||
int perm = NUM2INT(RARRAY_AREF(param, 2));
|
int perm = NUM2INT(RARRAY_AREF(param, 2));
|
||||||
int need_close = 1;
|
int need_close = 1;
|
||||||
int fd2 = redirect_open(path, flags, perm); /* async-signal-safe */
|
int fd2;
|
||||||
|
FilePathValue(vpath);
|
||||||
|
vpath = rb_str_encode_ospath(vpath);
|
||||||
|
fd2 = redirect_open(RSTRING_PTR(vpath), flags, perm); /* async-signal-safe */
|
||||||
if (fd2 == -1) {
|
if (fd2 == -1) {
|
||||||
ERRMSG("open");
|
ERRMSG("open");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -2928,6 +2931,11 @@ save_env(struct rb_execarg *sargp)
|
||||||
}
|
}
|
||||||
#endif
|
#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. */
|
/* This function should be async-signal-safe when sargp is NULL. Hopefully it is. */
|
||||||
int
|
int
|
||||||
rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
|
rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp, char *errmsg, size_t errmsg_buflen)
|
||||||
|
|
|
@ -420,6 +420,16 @@ class TestProcess < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
end
|
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 if windows? || Encoding.find('locale') == Encoding::UTF_8
|
||||||
|
|
||||||
UMASK = [RUBY, '-e', 'printf "%04o\n", File.umask']
|
UMASK = [RUBY, '-e', 'printf "%04o\n", File.umask']
|
||||||
|
|
||||||
def test_execopts_umask
|
def test_execopts_umask
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define RUBY_VERSION "2.2.5"
|
#define RUBY_VERSION "2.2.5"
|
||||||
#define RUBY_RELEASE_DATE "2016-03-09"
|
#define RUBY_RELEASE_DATE "2016-03-09"
|
||||||
#define RUBY_PATCHLEVEL 247
|
#define RUBY_PATCHLEVEL 248
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2016
|
#define RUBY_RELEASE_YEAR 2016
|
||||||
#define RUBY_RELEASE_MONTH 3
|
#define RUBY_RELEASE_MONTH 3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue