ruby-changes:21543
From: usa <ko1@a...>
Date: Tue, 1 Nov 2011 03:06:09 +0900 (JST)
Subject: [ruby-changes:21543] usa:r33591 (trunk): * ruby.c (load_file_internal): convert the encoding of load path if
usa 2011-11-01 03:05:03 +0900 (Tue, 01 Nov 2011) New Revision: 33591 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33591 Log: * 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(). Modified files: trunk/ChangeLog trunk/ruby.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33590) +++ ChangeLog (revision 33591) @@ -1,3 +1,17 @@ +Tue Nov 1 02:56:17 2011 NAKAMURA Usaku <usa@r...> + + * 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@f...> * ext/socket/socket.c (rsock_socketpair): extracted from @@ -54,7 +68,7 @@ * 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. Index: ruby.c =================================================================== --- ruby.c (revision 33590) +++ ruby.c (revision 33591) @@ -112,7 +112,7 @@ 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 @@ } 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 @@ struct load_file_arg { VALUE parser; - const char *fname; + VALUE fname; int script; struct cmdline_options *opt; }; @@ -1498,7 +1498,8 @@ 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 @@ } 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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/