Actions
Bug #5938
closedirb crashes on 2nd level tab complete if Module#name returns regexp
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.
Updated by nobu (Nobuyoshi Nakada) almost 13 years ago
- Tracker changed from Backport to Bug
- Project changed from Backport193 to Ruby master
Updated by nobu (Nobuyoshi Nakada) almost 13 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
Like0
Like0Like0