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

Hitting TAB causes a crash on ruby 2.7 (but not on ruby 2.5) #654

Closed
terceiro opened this issue Mar 4, 2020 · 2 comments · Fixed by #657
Closed

Hitting TAB causes a crash on ruby 2.7 (but not on ruby 2.5) #654

terceiro opened this issue Mar 4, 2020 · 2 comments · Fixed by #657

Comments

@terceiro
Copy link
Contributor

terceiro commented Mar 4, 2020

Problem description

Debian is at the moment transitioning between ruby2.5 and ruby2.7. I switched my own system to try to find issues on my daily usage, and hit this issue with byebug. This looks similar to #62, but since I now have a way of reproducing the problem, I thought of opening a new issue.

I found this first on my own user account. I suspected it would have something to do with my ~/.irbrc, and then I tried on a clean user account, and on a fresh docker container, all with the same results.

Steps to reproduce the problem

the log below was slightly edited to fit the text width here, but it's real.

~$ docker run -it debian:sid
root@32e081019d98:/# apt update
root@32e081019d98:/# apt -qy install ruby2.5 ruby2.7 ruby-byebug
[....]
root@32e081019d98:/# cat > test.rb
x = 1
puts(x)
root@32e081019d98:/# ruby2.7 -S byebug test.rb 

[1, 2] in /test.rb
=> 1: x = 1
   2: puts(x)
(byebug) <TAB>undefined method `workspace' for nil:NilClass
["/usr/lib/ruby/2.7.0/irb/completion.rb:45:in `retrieve_completion_data'",
 "/usr/lib/ruby/2.7.0/irb/completion.rb:42:in `block in <module:InputCompletor>'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/interfaces/local_interface.rb:24:in `readline'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/interfaces/local_interface.rb:24:in `block in readline'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/interfaces/local_interface.rb:36:in `with_repl_like_sigint'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/interfaces/local_interface.rb:24:in `readline'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/interface.rb:71:in `prepare_input'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/interface.rb:55:in `read_input'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/interface.rb:38:in `read_command'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/processors/command_processor.rb:128:in `repl'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/processors/command_processor.rb:97:in `process_commands'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/processors/command_processor.rb:55:in `at_line'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/context.rb:98:in `at_line'",
 "/test.rb:1:in `<top (required)>'", "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/runner.rb:186:in `debug_load'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/runner.rb:186:in `debug_program'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/runner.rb:103:in `block in run'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/runner.rb:102:in `loop'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/lib/byebug/runner.rb:102:in `run'",
 "/usr/lib/x86_64-linux-gnu/rubygems-integration/2.7.0/gems/byebug-11.1.1/exe/byebug:6:in `<top (required)>'",
 "/usr/bin/byebug:23:in `load'",
 "/usr/bin/byebug:23:in `<main>'"
]

I also tried by installing byebug via rubygems, with the same results:

$ gem list | grep -v default
byebug (11.1.1)
rake (13.0.1, 10.0.0)
thor (1.0.1)
$ byebug /tmp/test.rb 

[1, 2] in /tmp/test.rb
=> 1: x = 1
   2: puts(x)
(byebug) <TAB>undefined method `workspace' for nil:NilClass
[... same backtrace ...]
terceiro added a commit to terceiro/byebug that referenced this issue Mar 30, 2020
When IRB from ruby 2.7 is loaded, it installs a Readline completion proc
that assumes IRB is running (and crashes otherwise). Workaround this by
clearing the Readline completion when using it directly.

Fixes deivid-rodriguez#654
terceiro added a commit to terceiro/byebug that referenced this issue Mar 30, 2020
When IRB from ruby 2.7 is loaded, it installs a Readline completion proc
that assumes IRB is running (and crashes otherwise). Workaround this by
clearing the Readline completion when using it directly.

Fixes deivid-rodriguez#654
@agildav
Copy link

agildav commented Apr 11, 2020

+1

terceiro added a commit to terceiro/byebug that referenced this issue Apr 13, 2020
When IRB from ruby 2.7 is loaded, it installs a Readline completion proc
that assumes IRB is running (and crashes otherwise). Workaround this by
clearing the Readline completion when using it directly.

Fixes deivid-rodriguez#654
deivid-rodriguez pushed a commit to terceiro/byebug that referenced this issue Apr 14, 2020
When IRB from ruby 2.7 is loaded, it installs a Readline completion proc
that assumes IRB is running (and crashes otherwise). Workaround this by
clearing the Readline completion when using it directly.

Fixes deivid-rodriguez#654
deivid-rodriguez pushed a commit to terceiro/byebug that referenced this issue Apr 14, 2020
When IRB from ruby 2.7 is loaded, it installs a Readline completion proc
that assumes IRB is running (and crashes otherwise). Workaround this by
clearing the Readline completion when using it directly.

Fixes deivid-rodriguez#654
@lem0nify
Copy link

Same for ruby 2.6 btw.
I use ruby 2.6.6p146 and have the same issue.

deivid-rodriguez pushed a commit to terceiro/byebug that referenced this issue Apr 16, 2020
When IRB from ruby 2.7 is loaded, it installs a Readline completion proc
that assumes IRB is running (and crashes otherwise). Workaround this by
clearing the Readline completion when using it directly.

Fixes deivid-rodriguez#654
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants