diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-31 18:05:03 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-31 18:05:03 +0000 |
commit | 9b8aca6ae56e7b164c919e11adb3c035375a794e (patch) | |
tree | 975eb9ce6e3b2f4fb11557c8563e2a7fb9e5f6eb | |
parent | 8ce4a284e438bf1b5a652a7d27db84f24fb742ff (diff) | |
download | ruby-9b8aca6ae56e7b164c919e11adb3c035375a794e.tar.gz |
* ruby.c (load_file_internal): convert the encoding of load path if
needed by platform. calling open() was replaced by rb_cloexec_open()
at r33549, but the function expected UTF-8 pathname on Windows.
(open() expected "locale" pathname.)
reported by taco via IRC.
* ruby.c (load_file): change the type of the 2nd parameter to pass its
encoding to load_file_internal().
* ruby.c (process_options, rb_load_file): follow above change.
NOTE: we should pass encoding information to rb_load_file().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | ruby.c | 14 |
2 files changed, 23 insertions, 7 deletions
@@ -1,3 +1,17 @@ +Tue Nov 1 02:56:17 2011 NAKAMURA Usaku <usa@ruby-lang.org> + + * ruby.c (load_file_internal): convert the encoding of load path if + needed by platform. calling open() was replaced by rb_cloexec_open() + at r33549, but the function expected UTF-8 pathname on Windows. + (open() expected "locale" pathname.) + reported by taco via IRC. + + * ruby.c (load_file): change the type of the 2nd parameter to pass its + encoding to load_file_internal(). + + * ruby.c (process_options, rb_load_file): follow above change. + NOTE: we should pass encoding information to rb_load_file(). + Mon Oct 31 23:49:38 2011 Tanaka Akira <akr@fsij.org> * ext/socket/socket.c (rsock_socketpair): extracted from @@ -54,7 +68,7 @@ Mon Oct 31 13:10:06 2011 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.c (setfl): extract from fcntl(). - * win32/win32.c (dupfd): new function to support F_DUPFD. base on a + * win32/win32.c (dupfd): new function to support F_DUPFD. based on a patch written by akr. * win32/win32.c (fcntl): use above functions. @@ -112,7 +112,7 @@ cmdline_options_init(struct cmdline_options *opt) return opt; } -static NODE *load_file(VALUE, const char *, int, struct cmdline_options *); +static NODE *load_file(VALUE, VALUE, int, struct cmdline_options *); static void forbid_setid(const char *, struct cmdline_options *); #define forbid_setid(s) forbid_setid((s), opt) @@ -1402,7 +1402,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt) } PREPARE_PARSE_MAIN({ - tree = load_file(parser, opt->script, 1, opt); + tree = load_file(parser, opt->script_name, 1, opt); }); } rb_progname = opt->script_name; @@ -1487,7 +1487,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt) struct load_file_arg { VALUE parser; - const char *fname; + VALUE fname; int script; struct cmdline_options *opt; }; @@ -1498,7 +1498,8 @@ load_file_internal(VALUE arg) extern VALUE rb_stdin; struct load_file_arg *argp = (struct load_file_arg *)arg; VALUE parser = argp->parser; - const char *fname = argp->fname; + VALUE fname_v = rb_str_encode_ospath(argp->fname); + const char *fname = StringValueCStr(fname_v); int script = argp->script; struct cmdline_options *opt = argp->opt; VALUE f; @@ -1657,7 +1658,7 @@ restore_lineno(VALUE lineno) } static NODE * -load_file(VALUE parser, const char *fname, int script, struct cmdline_options *opt) +load_file(VALUE parser, VALUE fname, int script, struct cmdline_options *opt) { struct load_file_arg arg; arg.parser = parser; @@ -1671,8 +1672,9 @@ void * rb_load_file(const char *fname) { struct cmdline_options opt; + VALUE fname_v = rb_str_new_cstr(fname); - return load_file(rb_parser_new(), fname, 0, cmdline_options_init(&opt)); + return load_file(rb_parser_new(), fname_v, 0, cmdline_options_init(&opt)); } static void |