ruby-changes:56730
From: nagachika <ko1@a...>
Date: Wed, 31 Jul 2019 23:47:57 +0900 (JST)
Subject: [ruby-changes:56730] nagachika: 86c338d6e5 (ruby_2_6): merge revision(s) ea42423908ed055f9039b1dce6e9a232a3b2dd90: [Backport #15887]
https://git.ruby-lang.org/ruby.git/commit/?id=86c338d6e5 From 86c338d6e5a9ce6b2c3c5ad0769020bc41952f73 Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Wed, 31 Jul 2019 14:47:34 +0000 Subject: merge revision(s) ea42423908ed055f9039b1dce6e9a232a3b2dd90: [Backport #15887] Keep vm->orig_progname alive `vm->orig_progname` can be different from `vm->progname` when user code assigns to `$0`. While `vm->progname` is kept alive by the global table, nothing marked `vm->orig_progname`. [Bug #15887] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 7911a0c..b2f1ad7 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1400,6 +1400,14 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1400 } end + def test_argv0_keep_alive + assert_in_out_err([], <<~REPRO, ['-'], [], "[Bug #15887]") + $0 = "diverge" + 4.times { GC.start } + puts Process.argv0 + REPRO + end + def test_status with_tmpchdir do s = run_in_child("exit 1") diff --git a/version.h b/version.h index e0ae72f..a8e3b29 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1 #define RUBY_VERSION "2.6.3" #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 72 +#define RUBY_PATCHLEVEL 73 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 7 diff --git a/vm.c b/vm.c index 56f815e..6d54a81 100644 --- a/vm.c +++ b/vm.c @@ -2216,6 +2216,7 @@ rb_vm_mark(void *ptr) https://github.com/ruby/ruby/blob/trunk/vm.c#L2216 rb_gc_mark(vm->loaded_features); rb_gc_mark(vm->loaded_features_snapshot); rb_gc_mark(vm->top_self); + rb_gc_mark(vm->orig_progname); RUBY_MARK_UNLESS_NULL(vm->coverages); rb_gc_mark(vm->defined_module_hash); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/