Project

General

Profile

Bug #15989

irb-1.1.0.pre.1 crashes on using arrow up, home and delete

Added by maciej.mensfeld (Maciej Mensfeld) 4 months ago. Updated 3 months ago.

Status:
Rejected
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-07-04T09:54:50Z master 265b9a0edf) [x86_64-linux] last_commit=Parse key sequence more strictly
[ruby-core:93561]

Description

When I do this:

  1. Start irb
  2. Define empty string ''
  3. Press arrow up
  4. Press Home
  5. Press Delete to remove first '
  6. irb crashes

I get following exception:

    33: from ../install/bin/irb:23:in `<main>'
    32: from ../install/bin/irb:23:in `load'
    31: from /workdir/install/lib/ruby/gems/2.7.0/gems/irb-1.1.0.pre.1/exe/irb:11:in `<top (required)>'
    30: from /workdir/install/lib/ruby/2.7.0/irb.rb:389:in `start'
    29: from /workdir/install/lib/ruby/2.7.0/irb.rb:431:in `run'
    28: from /workdir/install/lib/ruby/2.7.0/irb.rb:431:in `catch'
    27: from /workdir/install/lib/ruby/2.7.0/irb.rb:432:in `block in run'
    26: from /workdir/install/lib/ruby/2.7.0/irb.rb:496:in `eval_input'
    25: from /workdir/install/lib/ruby/2.7.0/irb/ruby-lex.rb:125:in `each_top_level_statement'
    24: from /workdir/install/lib/ruby/2.7.0/irb/ruby-lex.rb:125:in `catch'
    23: from /workdir/install/lib/ruby/2.7.0/irb/ruby-lex.rb:126:in `block in each_top_level_statement'
    22: from /workdir/install/lib/ruby/2.7.0/irb/ruby-lex.rb:126:in `loop'
    21: from /workdir/install/lib/ruby/2.7.0/irb/ruby-lex.rb:129:in `block (2 levels) in each_top_level_statement'
    20: from /workdir/install/lib/ruby/2.7.0/irb/ruby-lex.rb:157:in `lex'
    19: from /workdir/install/lib/ruby/2.7.0/irb.rb:477:in `block in eval_input'
    18: from /workdir/install/lib/ruby/2.7.0/irb.rb:654:in `signal_status'
    17: from /workdir/install/lib/ruby/2.7.0/irb.rb:478:in `block (2 levels) in eval_input'
    16: from /workdir/install/lib/ruby/2.7.0/irb/input-method.rb:259:in `gets'
    15: from /workdir/install/lib/ruby/2.7.0/reline.rb:296:in `readmultiline'
    14: from /workdir/install/lib/ruby/2.7.0/reline.rb:357:in `inner_readline'
    13: from /workdir/install/lib/ruby/2.7.0/reline.rb:357:in `loop'
    12: from /workdir/install/lib/ruby/2.7.0/reline.rb:358:in `block in inner_readline'
    11: from /workdir/install/lib/ruby/2.7.0/reline.rb:387:in `read_io'
    10: from /workdir/install/lib/ruby/2.7.0/reline.rb:387:in `loop'
     9: from /workdir/install/lib/ruby/2.7.0/reline.rb:393:in `block in read_io'
     8: from /workdir/install/lib/ruby/2.7.0/reline.rb:359:in `block (2 levels) in inner_readline'
     7: from /workdir/install/lib/ruby/2.7.0/reline.rb:359:in `each'
     6: from /workdir/install/lib/ruby/2.7.0/reline.rb:360:in `block (3 levels) in inner_readline'
     5: from /workdir/install/lib/ruby/2.7.0/reline/line_editor.rb:779:in `input_key'
     4: from /workdir/install/lib/ruby/2.7.0/reline/line_editor.rb:675:in `process_key'
     3: from /workdir/install/lib/ruby/2.7.0/reline/line_editor.rb:675:in `call'
     2: from /workdir/install/lib/ruby/2.7.0/reline/line_editor.rb:999:in `key_delete'
     1: from /workdir/install/lib/ruby/2.7.0/reline/line_editor.rb:1734:in `ed_delete_next_char'
/workdir/install/lib/ruby/2.7.0/reline/line_editor.rb:1734:in `-': nil can't be coerced into Integer (TypeError)

attached a demo made with asciinema. Play (or cat as it's a text file) with: asciinema play error.dat


Files

asciinema - error.dat (5.21 KB) asciinema - error.dat maciej.mensfeld (Maciej Mensfeld), 07/05/2019 04:29 PM
demo.gif (41.4 KB) demo.gif maciej.mensfeld (Maciej Mensfeld), 07/05/2019 04:40 PM

History

#1

Updated by maciej.mensfeld (Maciej Mensfeld) 4 months ago

  • Description updated (diff)

Updated by maciej.mensfeld (Maciej Mensfeld) 4 months ago

Adding a demo gif code

Updated by tanguyandreani (Tanguy Andreani) 4 months ago

I can reproduce (by hitting del at the end of the line). The cause is in the snippet below.

Reline::Unicode.get_next_mbchar_size('')
# => nil

get_next_mbchar_size() doesn't always return a number.

According to ruby/ruby@9c136f3 we're supposed to hit ^D to join with the next line.

Updated by ko1 (Koichi Sasada) 4 months ago

  • Assignee set to aycabta (aycabta .)
  • Status changed from Open to Rejected

could you continue on github issue?
https://github.com/ruby/irb

Updated by aycabta (aycabta .) 3 months ago

maciej.mensfeld (Maciej Mensfeld) In latest revisions of IRB and Reline, this problem can't be reproduced. Maybe it's fixed.

Also available in: Atom PDF