summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-26 15:02:19 (GMT)
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-26 15:02:19 (GMT)
commit2576b8b26a34615e23ee43eef5b280b57e162c59 (patch)
tree9d41e3d0dad46c630839f6838d00d311de3e7235
parent401da7918827a75a737c023ee11631792bc908ca (diff)
merge revision(s) ac00bdc8a8ac2c62a94dd36a7784d15bbcb7df19: [Backport #15821]
Do not modify shared array [Bug #15821] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ruby.c13
-rw-r--r--test/ruby/test_gc.rb4
-rw-r--r--version.h2
3 files changed, 17 insertions, 2 deletions
diff --git a/ruby.c b/ruby.c
index 5a7032a..4ff30cc 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1604,8 +1604,12 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
rb_obj_freeze(opt->script_name);
if (IF_UTF8_PATH(uenc != lenc, 1)) {
long i;
- VALUE load_path = GET_VM()->load_path;
+ rb_vm_t *vm = GET_VM();
+ VALUE load_path = vm->load_path;
const ID id_initial_load_path_mark = INITIAL_LOAD_PATH_MARK;
+ int modifiable = FALSE;
+
+ rb_get_expanded_load_path();
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;
@@ -1617,8 +1621,15 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
path = rb_enc_associate(rb_str_dup(path), lenc);
#endif
if (mark) rb_ivar_set(path, id_initial_load_path_mark, path);
+ if (!modifiable) {
+ rb_ary_modify(load_path);
+ modifiable = TRUE;
+ }
RARRAY_ASET(load_path, i, path);
}
+ if (modifiable) {
+ rb_ary_replace(vm->load_path_snapshot, load_path);
+ }
}
Init_ext(); /* load statically linked extensions before rubygems */
if (opt->features & FEATURE_BIT(gems)) {
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 7a6309b..8873813 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -383,6 +383,10 @@ class TestGc < Test::Unit::TestCase
end;
end
+ def test_gc_stress_at_startup
+ assert_in_out_err([{"RUBY_DEBUG"=>"gc_stress"}], '', [], [], '[Bug #15784]', success: true)
+ end
+
def test_gc_disabled_start
begin
disabled = GC.disable
diff --git a/version.h b/version.h
index 220de0f..7043aa1 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.5.6"
#define RUBY_RELEASE_DATE "2019-08-26"
-#define RUBY_PATCHLEVEL 178
+#define RUBY_PATCHLEVEL 179
#define RUBY_RELEASE_YEAR 2019
#define RUBY_RELEASE_MONTH 8