Project

General

Profile

Actions

Bug #8837

closed

net/telnet: strange implementation

Added by paddor (Patrik Wenger) over 11 years ago. Updated over 8 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin10.8.0]
Backport:
[ruby-core:56881]

Description

=begin
Net::Telnet#waitfor has IMHO a very strange line. See https://github.com/ruby/ruby/blob/trunk/lib/net/telnet.rb#L586.

As far as I can tell, this line always results in setting (({rest = ""})) due to the regular expression above always matching at the end of (({buf})).

Also, since (({rest})) is set to an empty string right before that, I think this line can be removed.

What's your opinion?

=end

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

Seems that it should be:

             if pt = buf.rindex(/\r\z/no)
               buf, rest = buf[0 ... pt], buf[pt .. -1]
             end

or

             if buf.chomp!("\r")
               rest = "\r"
             end

to me.

Updated by hsbt (Hiroshi SHIBATA) over 8 years ago

  • Status changed from Open to Rejected
  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN to 2.1: UNKNOWN

net-telnet has been extracted https://github.com/ruby/net-telnet

Actions

Also available in: Atom PDF

Like0
Like0Like0