From 390220579b7afe433731f4d2d119a57858e27911 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Sun, 23 Nov 2025 12:47:33 -0500 Subject: [PATCH 1/3] Replace vfork with fork for ASAN Older versions of ASAN do not support vfork. See https://github.com/google/sanitizers/issues/925 --- process.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/process.c b/process.c index 46c55abcce42c6..8d6953282aaa41 100644 --- a/process.c +++ b/process.c @@ -4011,7 +4011,10 @@ retry_fork_async_signal_safe(struct rb_process_status *status, int *ep, while (1) { prefork(); disable_child_handler_before_fork(&old); -#ifdef HAVE_WORKING_VFORK + + // Older versions of ASAN does not work with vfork + // See https://github.com/google/sanitizers/issues/925 +#if defined(HAVE_WORKING_VFORK) && !defined(RUBY_ASAN_ENABLED) if (!has_privilege()) pid = vfork(); else From 8d73a181879d3151bb5e7ecf928ec098d154d498 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Sun, 23 Nov 2025 13:58:50 -0500 Subject: [PATCH 2/3] [ruby/prism] Handle destroying implicit parameter Fixes https://github.com/ruby/prism/pull/3740 https://github.com/ruby/prism/commit/464a849184 --- prism/prism.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/prism/prism.c b/prism/prism.c index a5475b17530907..2e0c941918bd49 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -13849,6 +13849,18 @@ parse_write(pm_parser_t *parser, pm_node_t *target, pm_token_t *operator, pm_nod // syntax error. In this case we'll fall through to our default // handling. We need to free the value that we parsed because there // is no way for us to attach it to the tree at this point. + switch (PM_NODE_TYPE(value)) { + case PM_LOCAL_VARIABLE_READ_NODE: + case PM_IT_LOCAL_VARIABLE_READ_NODE: + // Since it is possible for the value to be an implicit + // parameter, we need to remove it from the list of implicit + // parameters. + parse_target_implicit_parameter(parser, value); + break; + default: + break; + } + pm_node_destroy(parser, value); } PRISM_FALLTHROUGH From b75cf83a333ab4e321e89cdefb94e684f6648033 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Sun, 23 Nov 2025 16:35:17 -0500 Subject: [PATCH 3/3] [ruby/prism] Revert "Reject `p(p a, &block => value)` and similar" https://github.com/ruby/prism/commit/fef2c20777 --- prism/prism.c | 21 +---------- test/prism/errors/command_calls_35.txt | 41 --------------------- test/prism/fixtures/command_method_call.txt | 6 --- 3 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 test/prism/errors/command_calls_35.txt diff --git a/prism/prism.c b/prism/prism.c index 2e0c941918bd49..186cdd354c9843 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -14244,25 +14244,6 @@ parse_assocs(pm_parser_t *parser, pm_static_literals_t *literals, pm_node_t *nod return contains_keyword_splat; } -static inline bool -argument_allowed_for_bare_hash(pm_parser_t *parser, pm_node_t *argument) { - if (pm_symbol_node_label_p(argument)) { - return true; - } - - switch (PM_NODE_TYPE(argument)) { - case PM_CALL_NODE: { - pm_call_node_t *cast = (pm_call_node_t *) argument; - if (cast->opening_loc.start == NULL && cast->arguments != NULL) { - return false; - } - break; - } - default: break; - } - return accept1(parser, PM_TOKEN_EQUAL_GREATER); -} - /** * Append an argument to a list of arguments. */ @@ -14420,7 +14401,7 @@ parse_arguments(pm_parser_t *parser, pm_arguments_t *arguments, bool accepts_for bool contains_keywords = false; bool contains_keyword_splat = false; - if (argument_allowed_for_bare_hash(parser, argument)){ + if (pm_symbol_node_label_p(argument) || accept1(parser, PM_TOKEN_EQUAL_GREATER)) { if (parsed_bare_hash) { pm_parser_err_previous(parser, PM_ERR_ARGUMENT_BARE_HASH); } diff --git a/test/prism/errors/command_calls_35.txt b/test/prism/errors/command_calls_35.txt deleted file mode 100644 index 9eb011cd86ca61..00000000000000 --- a/test/prism/errors/command_calls_35.txt +++ /dev/null @@ -1,41 +0,0 @@ -p(p a, x: b => value) - ^~ unexpected '=>'; expected a `)` to close the arguments - ^ unexpected ')', expecting end-of-input - ^ unexpected ')', ignoring it - -p(p a, x: => value) - ^~ unexpected '=>'; expected a `)` to close the arguments - ^ unexpected ')', expecting end-of-input - ^ unexpected ')', ignoring it - -p(p a, &block => value) - ^~ unexpected '=>'; expected a `)` to close the arguments - ^ unexpected ')', expecting end-of-input - ^ unexpected ')', ignoring it - -p(p a, *args => value) - ^~ unexpected '=>'; expected a `)` to close the arguments - ^ unexpected ')', expecting end-of-input - ^ unexpected ')', ignoring it - -p(p a, **kwargs => value) - ^~ unexpected '=>'; expected a `)` to close the arguments - ^ unexpected ')', expecting end-of-input - ^ unexpected ')', ignoring it - -p p 1, &block => 2, &block - ^~ unexpected '=>', expecting end-of-input - ^~ unexpected '=>', ignoring it - ^ unexpected ',', expecting end-of-input - ^ unexpected ',', ignoring it - ^ unexpected '&', ignoring it - -p p p 1 => 2 => 3 => 4 - ^~ unexpected '=>', expecting end-of-input - ^~ unexpected '=>', ignoring it - -p[p a, x: b => value] - ^ expected a matching `]` - ^ unexpected ']', expecting end-of-input - ^ unexpected ']', ignoring it - diff --git a/test/prism/fixtures/command_method_call.txt b/test/prism/fixtures/command_method_call.txt index 3f510efa6935d6..182b87948b52d5 100644 --- a/test/prism/fixtures/command_method_call.txt +++ b/test/prism/fixtures/command_method_call.txt @@ -39,9 +39,3 @@ def foo = bar 1 !foo 1 or !bar 2 not !foo 1 - -foo(bar baz, key => value) - -foo(bar baz, KEY => value) - -foo(bar baz, :key => value)