Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby: (some) builtin functions not available with ruby 3.3 #2109

Open
u3shit opened this issue Apr 30, 2024 · 4 comments
Open

ruby: (some) builtin functions not available with ruby 3.3 #2109

u3shit opened this issue Apr 30, 2024 · 4 comments
Assignees
Labels
bug Unexpected problem or unintended behavior waiting info Waiting for info from author of issue

Comments

@u3shit
Copy link

u3shit commented Apr 30, 2024

Describe the bug

Upgrading my ruby from 3.1 to 3.3.1, my very simple script stopped working because it couldn't find Kernel.loop. (But it's also easily reproducible from /ruby eval).

Steps to reproduce

  1. /ruby eval [].shuffle or /ruby eval loop { break } or call any other function defined in .rbinc files.

Current behavior

21:51:28 =!= | ruby: error: (eval at (eval at eval:34):7):1:in `script_ruby_eval': undefined method `shuffle' for an instance of Array (#<Class:#<NoMethodError:0x00007f4b6cdd6d78>>)
21:51:28 =!= | ruby: error:      from (eval at eval:34):7:in `module_eval'
21:51:28 =!= | ruby: error:      from (eval at eval:34):7:in `script_ruby_eval'

Expected behavior

Built-in ruby functions work...

Suggested solutions

No response

Additional information

No response

WeeChat version

4.2.2

What OS are you using?

Gentoo

On which terminal are you running WeeChat?

No response

Which terminal multiplexer are you using?

No response

@u3shit u3shit added the bug Unexpected problem or unintended behavior label Apr 30, 2024
@u3shit
Copy link
Author

u3shit commented Apr 30, 2024

Looks like ruby_process_options need to be called now, it calls a bunch of (private) setup functions, something sets up these builtin methods. As a very quick and dirty workaround, adding

char* dummy_argv[] = { "ruby", "-enil", NULL };
ruby_process_options(2, dummy_argv);

after ruby_init seemingly fixes the problem... But some MRI wizard can probably come up with a better solution.

@flashcode
Copy link
Member

Hi,

Where can I find documentation on the function ruby_process_options ?
I just found the header ruby/internal/interpreter.h but the information is not detailed there.

@flashcode flashcode self-assigned this May 31, 2024
@flashcode flashcode added the waiting info Waiting for info from author of issue label May 31, 2024
@u3shit
Copy link
Author

u3shit commented May 31, 2024

Well, the ruby c api's documentation is pretty much non-existent. There's a bugreport from a decade ago that's still not fixed: https://bugs.ruby-lang.org/issues/7424 (see also the follow-up issue)

@u3shit
Copy link
Author

u3shit commented May 31, 2024

Well, ok, there's ruby_options that's "documented" and more or less just calls ruby_process_options: https://docs.ruby-lang.org/en/3.3/extension_rdoc.html

Calling ruby_options also seem to solve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected problem or unintended behavior waiting info Waiting for info from author of issue
Projects
None yet
Development

No branches or pull requests

2 participants