summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--ruby.c14
2 files changed, 23 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 11b17ea25b..b6828bbc84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/ruby.c b/ruby.c
index 944f214560..7e06a128dc 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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