Project

General

Profile

Actions

Bug #17503

closed

Typing an invalid percent string crashes irb

Added by niconii (Nicolette Verlinden) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
[ruby-core:101884]

Description

  1. Start irb.
  2. Try typing in %abc. Keep typing in alphanumeric characters if it hasn't crashed yet.
  3. irb crashes with the following error message:
/usr/local/lib/ruby/3.0.0/reline/unicode.rb:124:in `calculate_width': undefined method `encode' for nil:NilClass (NoMethodError)
        from /usr/local/lib/ruby/3.0.0/reline/line_editor.rb:1314:in `calculate_width'
        from /usr/local/lib/ruby/3.0.0/reline/line_editor.rb:126:in `check_multiline_prompt'
        from /usr/local/lib/ruby/3.0.0/reline/line_editor.rb:365:in `rerender'
        from /usr/local/lib/ruby/3.0.0/reline.rb:248:in `block (3 levels) in inner_readline'
        from /usr/local/lib/ruby/3.0.0/reline.rb:246:in `each'
        from /usr/local/lib/ruby/3.0.0/reline.rb:246:in `block (2 levels) in inner_readline'
        from /usr/local/lib/ruby/3.0.0/reline.rb:330:in `block in read_io'
        from /usr/local/lib/ruby/3.0.0/reline.rb:284:in `loop'
        from /usr/local/lib/ruby/3.0.0/reline.rb:284:in `read_io'
        from /usr/local/lib/ruby/3.0.0/reline.rb:245:in `block in inner_readline'
        from /usr/local/lib/ruby/3.0.0/reline.rb:243:in `loop'
        from /usr/local/lib/ruby/3.0.0/reline.rb:243:in `inner_readline'
        from /usr/local/lib/ruby/3.0.0/reline.rb:175:in `readmultiline'
        from /usr/local/lib/ruby/3.0.0/forwardable.rb:238:in `readmultiline'
        from /usr/local/lib/ruby/3.0.0/forwardable.rb:238:in `readmultiline'
        from /usr/local/lib/ruby/3.0.0/irb/input-method.rb:302:in `gets'
        from /usr/local/lib/ruby/3.0.0/irb.rb:519:in `block (2 levels) in eval_input'
        from /usr/local/lib/ruby/3.0.0/irb.rb:721:in `signal_status'
        from /usr/local/lib/ruby/3.0.0/irb.rb:518:in `block in eval_input'
        from /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:202:in `lex'
        from /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:174:in `block (2 levels) in each_top_level_statement'
        from /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:171:in `loop'
        from /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:171:in `block in each_top_level_statement'
        from /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:170:in `catch'
        from /usr/local/lib/ruby/3.0.0/irb/ruby-lex.rb:170:in `each_top_level_statement'
        from /usr/local/lib/ruby/3.0.0/irb.rb:537:in `eval_input'
        from /usr/local/lib/ruby/3.0.0/irb.rb:472:in `block in run'
        from /usr/local/lib/ruby/3.0.0/irb.rb:471:in `catch'
        from /usr/local/lib/ruby/3.0.0/irb.rb:471:in `run'
        from /usr/local/lib/ruby/3.0.0/irb.rb:400:in `start'
        from /usr/local/lib/ruby/gems/3.0.0/gems/irb-1.3.0/exe/irb:11:in `<top (required)>'
        from /usr/local/bin/irb:23:in `load'
        from /usr/local/bin/irb:23:in `<main>'

Updated by pocke (Masataka Kuwabara) over 3 years ago

https://github.com/ruby/irb/issues/162
Probably I met the same problem and I reported it as the issue.

Updated by aycabta (aycabta .) over 3 years ago

  • Status changed from Open to Closed

Thank you for the reporting. This is fixed by https://github.com/ruby/irb/pull/163.

Actions

Also available in: Atom PDF

Like0
Like0Like0