ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "nagachika (Tomoyuki Chikanaga)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:107851] [Ruby master Bug#18250] Anonymous variables seem to break `Ractor.make_shareable`
Date: Sat, 12 Mar 2022 05:29:25 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-96791.20220312052924.73@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-18250.20211012234328.73@ruby-lang.org

Issue #18250 has been updated by nagachika (Tomoyuki Chikanaga).


I have confirmed the bootstraptest/test_ractor.rb cause SEGV after backporting the commits in my previous comment https://bugs.ruby-lang.org/issues/18250#note-12.


----------------------------------------
Bug #18250: Anonymous variables seem to break `Ractor.make_shareable`
https://bugs.ruby-lang.org/issues/18250#change-96791

* Author: tenderlovemaking (Aaron Patterson)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20]
* Backport: 2.7: DONTNEED, 3.0: REQUIRED
----------------------------------------
The following code breaks with a strange error:

```ruby
def foo(*); ->{ super };end
Ractor.make_shareable(foo) # expected Symbol
```

Output:

```
[aaron@tc ~/g/ruby (master)]$ cat test.rb
def foo(*); ->{ super };end      
Ractor.make_shareable(foo) # expected Symbol
[aaron@tc ~/g/ruby (master)]$ ruby test.rb
<internal:ractor>:816:in `make_shareable': wrong argument type false (expected Symbol) (TypeError)
        from test.rb:2:in `<main>'
[aaron@tc ~/g/ruby (master)]$
```

The reason is because the `*` parameter has no name, but Ractor tries to find the name so it can make an exception.

I *expect* the above program to raise an `Ractor::IsolationError`, but instead it raises a `TypeError`.

I've attached a patch that fixes this bug.

---Files--------------------------------
0001-Give-params-a-name.patch (3.33 KB)


-- 
https://bugs.ruby-lang.org/

      parent reply	other threads:[~2022-03-12  5:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 23:43 [ruby-core:105626] [Ruby master Bug#18250] Anonymous variables seem to break `Ractor.make_shareable` tenderlovemaking (Aaron Patterson)
2021-10-13  2:21 ` [ruby-core:105627] " nobu (Nobuyoshi Nakada)
2021-10-13  7:46 ` [ruby-core:105629] " nobu (Nobuyoshi Nakada)
2021-11-12 16:47 ` [ruby-core:106037] " byroot (Jean Boussier)
2021-11-22  6:23 ` [ruby-core:106198] " nobu (Nobuyoshi Nakada)
2021-11-22 10:07 ` [ruby-core:106204] " byroot (Jean Boussier)
2021-11-22 11:16 ` [ruby-core:106205] " byroot (Jean Boussier)
2021-11-22 11:22 ` [ruby-core:106206] " byroot (Jean Boussier)
2021-11-24 14:57 ` [ruby-core:106265] " byroot (Jean Boussier)
2021-11-25  1:19 ` [ruby-core:106269] " nagachika (Tomoyuki Chikanaga)
2021-11-25  8:33 ` [ruby-core:106275] " byroot (Jean Boussier)
2021-11-26 16:46 ` [ruby-core:106292] " byroot (Jean Boussier)
2021-11-26 16:54 ` [ruby-core:106293] " byroot (Jean Boussier)
2022-03-12  5:29 ` nagachika (Tomoyuki Chikanaga) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-96791.20220312052924.73@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).