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

Fixed string escaping omissions #599

Merged
merged 1 commit into from
Jun 5, 2023
Merged

Conversation

ima1zumi
Copy link
Member

@ima1zumi ima1zumi commented Jun 5, 2023

Original issue was reported by @koic.

I received a RegexpError when I typed ::Array[.
Added Regexp.quote because receiver was not escaped.

Stack trace:

irb(main):001:1* ::Array[/Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:236:in `retrieve_completion_data': premature end of char-class: /^Array[/ (RegexpError)
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:151:in `block in <module:InputCompletor>'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:1631:in `call_completion_proc_with_checking_args'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:529:in `call_completion_proc_with_checking_args'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:239:in `block in <class:Core>'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:584:in `instance_exec'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:584:in `call'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:619:in `call'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:772:in `update_each_dialog'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:648:in `block in render_dialog'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:646:in `map'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:646:in `render_dialog'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/line_editor.rb:496:in `rerender'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:354:in `block (3 levels) in inner_readline'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:352:in `each'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:352:in `block (2 levels) in inner_readline'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:427:in `block in read_io'
        from <internal:kernel>:187:in `loop'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:397:in `read_io'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:350:in `block in inner_readline'
        from <internal:kernel>:187:in `loop'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:348:in `inner_readline'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:277:in `block in readmultiline'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/ansi.rb:149:in `block in with_raw_input'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/ansi.rb:149:in `raw'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline/ansi.rb:149:in `with_raw_input'
        from /Users/mi/ghq/github.com/ruby/reline/lib/reline.rb:273:in `readmultiline'
        from /Users/mi/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/forwardable.rb:240:in `readmultiline'
        from /Users/mi/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/forwardable.rb:240:in `readmultiline'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb/input-method.rb:418:in `gets'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb.rb:542:in `block (2 levels) in eval_input'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb.rb:770:in `signal_status'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb.rb:541:in `block in eval_input'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb/ruby-lex.rb:225:in `readmultiline'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb/ruby-lex.rb:250:in `block in each_top_level_statement'
        from <internal:kernel>:187:in `loop'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb/ruby-lex.rb:249:in `each_top_level_statement'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb.rb:560:in `eval_input'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb.rb:494:in `block in run'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb.rb:493:in `catch'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb.rb:493:in `run'
        from /Users/mi/ghq/github.com/ruby/irb/lib/irb.rb:416:in `start'
        from /Users/mi/ghq/github.com/ruby/irb/exe/irb:9:in `<main>'

I received a `RegexpError` when I typed `::Array[`.
::Array[/Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:236:in `retrieve_completion_data': premature end of char-class: /^Array[/ (RegexpError)
Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tompng tompng merged commit 3951757 into ruby:master Jun 5, 2023
24 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Jun 5, 2023
(ruby/irb#599)

I received a `RegexpError` when I typed `::Array[`.
::Array[/Users/mi/ghq/github.com/ruby/irb/lib/irb/completion.rb:236:in `retrieve_completion_data': premature end of char-class: /^Array[/ (RegexpError)
@ima1zumi ima1zumi deleted the fix-regexp-error branch June 6, 2023 00:19
@ima1zumi ima1zumi added the bug Something isn't working label Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

None yet

2 participants