From 3e02e99e425ee1c2e4a7cee625eaea6ed1faf1c4 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sat, 7 Feb 2026 08:44:08 -0800 Subject: Fix signal crash during keyword argument call 64f508ade8 changed rb_threadptr_raise to call rb_exception_setup, which uses rb_scan_args with RB_SCAN_ARGS_PASS_CALLED_KEYWORDS. This checked rb_keyword_given_p(), which read the interrupted frame's keyword state rather than the signal raise arguments, causing a crash when a signal arrived during a keyword call. Revert rb_threadptr_raise to use rb_make_exception directly, and have thread_raise_m call rb_exception_setup where rb_keyword_given_p() reflects the correct frame. [Bug #21865] --- test/ruby/test_signal.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb index 091a66d5da..1ee3720ded 100644 --- a/test/ruby/test_signal.rb +++ b/test/ruby/test_signal.rb @@ -350,4 +350,18 @@ class TestSignal < Test::Unit::TestCase loop { sleep } End end if Process.respond_to?(:kill) && Process.respond_to?(:daemon) + + def test_signal_during_kwarg_call + status = assert_in_out_err([], <<~'RUBY', [], [], success: false) + Thread.new do + sleep 0.1 + Process.kill("TERM", $$) + end + + loop do + File.open(IO::NULL, kwarg: true) {} + end + RUBY + assert_predicate(status, :signaled?) if Signal.list.include?("QUIT") + end if Process.respond_to?(:kill) end -- cgit v1.2.3