summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-10-14 12:38:52 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-10-14 12:38:52 +0900
commite94a2f691d67ad98be9036e76c765fcfa7d22552 (patch)
tree9495bd423fbee4b880e2c77d6a4c1aa04d5caf62
parentda3336c52b2884640a40adfc8d3a7f6032c4c259 (diff)
[Bug #21638] Mark ractor-local `$VERBOSE` and `$DEBUG`
https://github.com/sampersand/blog/blob/master/the%20-s%20flag.md#the-segfault
-rw-r--r--ractor.c2
-rw-r--r--test/ruby/test_rubyoptions.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/ractor.c b/ractor.c
index 43a7f6c140..8e7f7d6497 100644
--- a/ractor.c
+++ b/ractor.c
@@ -216,6 +216,8 @@ ractor_mark(void *ptr)
rb_gc_mark(r->r_stdin);
rb_gc_mark(r->r_stdout);
rb_gc_mark(r->r_stderr);
+ rb_gc_mark(r->verbose);
+ rb_gc_mark(r->debug);
rb_hook_list_mark(&r->pub.hooks);
if (r->threads.cnt > 0) {
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 8126cb3c26..527208cee5 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -530,6 +530,8 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(%w(- -#=foo), "#!ruby -s\n", [],
/invalid name for global variable - -# \(NameError\)/)
+
+ assert_in_out_err(['-s', '-e', 'GC.start; p $DEBUG', '--', '-DEBUG=x'], "", ['"x"'])
end
def test_option_missing_argument