From aae22e34086553d30d071e2575c240f6f89550d3 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 2 Jul 2015 05:12:04 +0000 Subject: [PATCH] ruby.c: copy initial load path marks * ruby.c (process_options): also copy initial load path marks at setting load paths encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ruby.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 40e2ec4a4a..a948c339c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jul 2 14:12:01 2015 Nobuyoshi Nakada + + * ruby.c (process_options): also copy initial load path marks at + setting load paths encoding. + Thu Jul 2 12:26:11 2015 Nobuyoshi Nakada * test/rubygems/test_gem_server.rb (process_based_port): use diff --git a/ruby.c b/ruby.c index cec83079be..9167b6837b 100644 --- a/ruby.c +++ b/ruby.c @@ -396,6 +396,8 @@ dladdr_path(const void* addr) } #endif +#define INITIAL_LOAD_PATH_MARK rb_intern_const("@gem_prelude_index") + void ruby_init_loadpath_safe(int safe_level) { @@ -513,7 +515,7 @@ ruby_init_loadpath_safe(int safe_level) ruby_push_include(getenv("RUBYLIB"), identical_path); } - id_initial_load_path_mark = rb_intern_const("@gem_prelude_index"); + id_initial_load_path_mark = INITIAL_LOAD_PATH_MARK; while (*paths) { size_t len = strlen(paths); VALUE path = RUBY_RELATIVE(paths, len); @@ -1421,9 +1423,12 @@ process_options(int argc, char **argv, struct cmdline_options *opt) { long i; VALUE load_path = GET_VM()->load_path; + const ID id_initial_load_path_mark = INITIAL_LOAD_PATH_MARK; for (i = 0; i < RARRAY_LEN(load_path); ++i) { VALUE path = RARRAY_AREF(load_path, i); + int mark = rb_attr_get(path, id_initial_load_path_mark) == path; path = rb_enc_associate(rb_str_dup(path), lenc); + if (mark) rb_ivar_set(path, id_initial_load_path_mark, path); RARRAY_ASET(load_path, i, path); } }