Bug #167

net/telnet login() method no longer works under 1.9

Added by Dave Thomas almost 7 years ago. Updated almost 4 years ago.

[ruby-core:17272]
Status:Closed
Priority:Normal
Assignee:-
ruby -v: Backport:

Description

=begin
dave[RUBY3/Book 23:25:26*] ruby -r net/telnet -e 'Net::Telnet.new({}).login "a", "b"'
/usr/local/rubybook/lib/ruby/1.9.0/net/telnet.rb:567:in Integer': can't convert nil into Integer (TypeError)
from /usr/local/rubybook/lib/ruby/1.9.0/net/telnet.rb:567:in
waitfor'
from /usr/local/rubybook/lib/ruby/1.9.0/net/telnet.rb:745:in login'
from -e:1:in
'
=end

Associated revisions

Revision 38690
Added by Eric Hodel about 2 years ago

  • lib/rdoc/cross_reference.rb: Fixed matching of C#=== or #===. RDoc bug #164
  • test/rdoc/test_rdoc_cross_reference.rb: Test for above.

  • lib/rdoc/parser/changelog.rb: Fixed parsing of dates. RDoc bug #165

  • test/rdoc/test_rdoc_parser_changelog.rb: Test for above.

  • lib/rdoc/parser.rb: Fixed parsing multibyte files with incomplete
    characters at byte 1024. [ruby-trunk - Bug #6393]
    Fixed handling of -E. [ruby-trunk - Bug #6392]

  • test/rdoc/test_rdoc_options.rb: Test for above.

  • test/rdoc/test_rdoc_parser.rb: ditto.

  • test/rdoc/test_rdoc_parser_c.rb: ditto.

  • test/rdoc/test_rdoc_parser_changelog.rb: ditto.

  • test/rdoc/test_rdoc_parser_markdown.rb: ditto.

  • test/rdoc/test_rdoc_parser_rd.rb: ditto.

  • test/rdoc/test_rdoc_rdoc.rb: ditto.

  • lib/rdoc/tom_doc.rb: Fixed parsing of [] in TomDoc arguments list.
    RDoc bug #167

  • test/rdoc/test_rdoc_tom_doc.rb: Test for above.

  • lib/rdoc.rb: Update version.

Revision 38690
Added by Eric Hodel about 2 years ago

  • lib/rdoc/cross_reference.rb: Fixed matching of C#=== or #===. RDoc bug #164
  • test/rdoc/test_rdoc_cross_reference.rb: Test for above.

  • lib/rdoc/parser/changelog.rb: Fixed parsing of dates. RDoc bug #165

  • test/rdoc/test_rdoc_parser_changelog.rb: Test for above.

  • lib/rdoc/parser.rb: Fixed parsing multibyte files with incomplete
    characters at byte 1024. [ruby-trunk - Bug #6393]
    Fixed handling of -E. [ruby-trunk - Bug #6392]

  • test/rdoc/test_rdoc_options.rb: Test for above.

  • test/rdoc/test_rdoc_parser.rb: ditto.

  • test/rdoc/test_rdoc_parser_c.rb: ditto.

  • test/rdoc/test_rdoc_parser_changelog.rb: ditto.

  • test/rdoc/test_rdoc_parser_markdown.rb: ditto.

  • test/rdoc/test_rdoc_parser_rd.rb: ditto.

  • test/rdoc/test_rdoc_rdoc.rb: ditto.

  • lib/rdoc/tom_doc.rb: Fixed parsing of [] in TomDoc arguments list.
    RDoc bug #167

  • test/rdoc/test_rdoc_tom_doc.rb: Test for above.

  • lib/rdoc.rb: Update version.

History

#1 Updated by Anonymous almost 7 years ago

=begin
On Jun 15, 2008, at 11:25 PM, Dave Thomas wrote:

Issue #167 has been reported by Dave Thomas.


Bug #167: net/telnet login() method no longer works under 1.9
http://redmine.ruby-lang.org/issues/show/167

Does this patch fix Telnet?

Index: lib/net/telnet.rb
===================================================================
--- lib/net/telnet.rb (revision 17373)
+++ lib/net/telnet.rb (working copy)
@@ -564,8 +564,8 @@
@dumplog.log_dump('<', c) if @options.has_key?("Dump_log")
if @options["Telnetmode"]
c = rest + c
- if Integer(c.rindex(/#{IAC}#{SE}/no)) <
- Integer(c.rindex(/#{IAC}#{SB}/no))
+ if Integer(c.rindex(/#{IAC}#{SE}/no) || 0) <
+ Integer(c.rindex(/#{IAC}#{SB}/no) || 0)
buf = preprocess(c[0 ... c.rindex(/#{IAC}#{SB}/no)])
rest = c[c.rindex(/#{IAC}#{SB}/no) .. -1]
elsif pt = c.rindex(/#{IAC}
[#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no) ||

Is it truly intended that nil no longer converts to 0 via Integer? If

so, I'm going to miss that.

James Edward Gray II

=end

#2 Updated by Dave Thomas almost 7 years ago

=begin
Yes, indeed it does...

Can we get it applied?

On Jun 16, 2008, at 5:21 PM, James Gray wrote:

On Jun 15, 2008, at 11:25 PM, Dave Thomas wrote:

Issue #167 has been reported by Dave Thomas.


Bug #167: net/telnet login() method no longer works under 1.9
http://redmine.ruby-lang.org/issues/show/167

Does this patch fix Telnet?

Index: lib/net/telnet.rb

--- lib/net/telnet.rb (revision 17373)
+++ lib/net/telnet.rb (working copy)
@@ -564,8 +564,8 @@
@dumplog.log_dump('<', c) if @options.has_key?("Dump_log")
if @options["Telnetmode"]
c = rest + c
- if Integer(c.rindex(/#{IAC}#{SE}/no)) <
- Integer(c.rindex(/#{IAC}#{SB}/no))
+ if Integer(c.rindex(/#{IAC}#{SE}/no) || 0) <
+ Integer(c.rindex(/#{IAC}#{SB}/no) || 0)
buf = preprocess(c[0 ... c.rindex(/#{IAC}#{SB}/no)])
rest = c[c.rindex(/#{IAC}#{SB}/no) .. -1]
elsif pt = c.rindex(/#{IAC}
[#{IAC}#{AO}#{AYT}#{DM}#{IP}#{NOP}]?\z/no) ||

Is it truly intended that nil no longer converts to 0 via Integer?

If so, I'm going to miss that.

James Edward Gray II

=end

#3 Updated by Anonymous almost 7 years ago

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

=begin
Applied in changeset r17387.
=end

#4 Updated by Anonymous almost 7 years ago

=begin
On Jun 16, 2008, at 9:13 PM, Dave Thomas wrote:

Yes, indeed it does...

Can we get it applied?

I've committed my fix.

I don't believe I have access to close the bug in Redmine though. Can

someone please handle that for me?

James Edward Gray II

=end

#5 Updated by Anonymous almost 7 years ago

=begin
On Jun 17, 2008, at 9:06 AM, James Gray wrote:

On Jun 16, 2008, at 9:13 PM, Dave Thomas wrote:

Yes, indeed it does...

Can we get it applied?

I've committed my fix.

I don't believe I have access to close the bug in Redmine though.

Can someone please handle that for me?

Nevermind. Redmine is much smarter than I realized and my commit

closed the issue.

James Edward Gray II

=end

Also available in: Atom PDF