Project

General

Profile

Actions

Bug #5938

closed

irb crashes on 2nd level tab complete if Module#name returns regexp

Added by eagspoo (foo bar) about 12 years ago. Updated about 12 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-core:42244]

Description

ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]

Copy this into irb and press tab :)

module Foo
def self.name
/foo/
end
end
[1].first.

In irb/completion.rb line 177:

name = m.name (where m is the module)

later

/some|stuff/ =~ name

If name is a regexp, boom.

Probably

name = m.name

should be

name = m.name.to_s

Since if that causes an exception it is already handled and name is set to "" or it will be harmlessly converted to a string.
Or the next if condition should also have a being/rescue around it.

Actions #1

Updated by nobu (Nobuyoshi Nakada) about 12 years ago

  • Tracker changed from Backport to Bug
  • Project changed from Backport193 to Ruby master
Actions #2

Updated by nobu (Nobuyoshi Nakada) about 12 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r34384.
foo, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/irb/completion.rb (IRB::InputCompletor::CompletionProc):
    ignore non-string name modules. [ruby-core:42244][Bug #5938]
Actions

Also available in: Atom PDF

Like0
Like0Like0