Project

General

Profile

Bug #167

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

Added by pragdave (Dave Thomas) almost 12 years ago. Updated almost 9 years ago.

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

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

#1

Updated by Anonymous almost 12 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 pragdave (Dave Thomas) almost 12 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 12 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 12 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 12 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