Project

General

Profile

Bug #3830

ruby 1.9.2 で Net::Telnet の close が undefined method となり実行できない

Added by khiker (Kiyoto HAMANO) almost 9 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
Backport:

Description

=begin
濱野と申します。
ruby-list:47391 からはじまるスレッドで尋ねた Ruby 1.9.2-p0 における
Net::Telenet の不具合について報告させて頂きます。

ruby-1.9.2-p0 で Net::Telnet クラスを使っていたところ、close を実
行しようとしたところ、undefined method と言われる現象に遭遇しまし
た。

ruby-list で尋ねたところ、原因は、SimpleDelegator をやめてしまった
ので @sock に委譲していたメソッドが使えなくなってしまったためとの
回答を頂きました。

申し分けありませんが、この件について、ご対応願えないでしょうか。

以下、もう少し詳細に書きます。

[再現方法]
以下のプログラムを、「IP アドレス」に適切な値を入れ、ruby-1.9.2-p0 で実
行する。

#!/usr/bin/env ruby

require 'net/telnet'

connect = Net::Telnet.new("Host" => "IP アドレス", "Timeout" => 120)

print "closing ..."
connect.close()
print "done\n"

# t.rb ends here

[結果]
ruby 1.9.2-p0 で行った場合の結果です。

$ lsb_release -d
Description: Debian GNU/Linux unstable (sid)
$ ruby-192 -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
$ ruby-192 /tmp/t.rb
closing .../tmp/t.rb:8:in <main>': undefined methodclose' for #Net::Telnet:0x881fdb4 (NoMethodError)

[期待する結果]
ruby 1.8.7 で行った場合の結果です。

$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i486-linux]
$ ruby /tmp/t.rb
closing ...done

[暫定的な解決策]
以下のコードをプログラムに追加する事で、ruby-1.9.2-p0 でも期待する結果
を得られました。

require 'net/telnet'
class Net::Telnet
def method_missing(m, *args, &block)
@sock.send(m, *args, &block)
end
end

=end


Files

telnet_close_docs.patch.gz (260 Bytes) telnet_close_docs.patch.gz erikh (Erik Hollensbe), 09/16/2010 05:41 AM
telnet_close_method.patch.gz (171 Bytes) telnet_close_method.patch.gz erikh (Erik Hollensbe), 09/16/2010 05:41 AM

Related issues

Related to Backport191 - Backport #3831: ruby 1.9.1-p430 で、Net::Telnet の login が undefined method となり実行できないOpen09/15/2010Actions

Associated revisions

Revision 0d5a81f4
Added by naruse (Yui NARUSE) over 8 years ago

  • lib/net/telnet.rb (Net::Telnet#close): added. patched by Erik Hollensbe [ruby-dev:42260] #3830

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 29544
Added by naruse (Yui NARUSE) over 8 years ago

  • lib/net/telnet.rb (Net::Telnet#close): added. patched by Erik Hollensbe [ruby-dev:42260] #3830

Revision 29544
Added by naruse (Yui NARUSE) over 8 years ago

  • lib/net/telnet.rb (Net::Telnet#close): added. patched by Erik Hollensbe [ruby-dev:42260] #3830

Revision 29544
Added by naruse (Yui NARUSE) over 8 years ago

  • lib/net/telnet.rb (Net::Telnet#close): added. patched by Erik Hollensbe [ruby-dev:42260] #3830

Revision 29544
Added by naruse (Yui NARUSE) over 8 years ago

  • lib/net/telnet.rb (Net::Telnet#close): added. patched by Erik Hollensbe [ruby-dev:42260] #3830

Revision 29544
Added by naruse (Yui NARUSE) over 8 years ago

  • lib/net/telnet.rb (Net::Telnet#close): added. patched by Erik Hollensbe [ruby-dev:42260] #3830

Revision 29544
Added by naruse (Yui NARUSE) over 8 years ago

  • lib/net/telnet.rb (Net::Telnet#close): added. patched by Erik Hollensbe [ruby-dev:42260] #3830

Revision ee72d1c4
Added by yugui (Yuki Sonoda) over 8 years ago

merges r29544 from trunk into ruby_1_9_2.

  • lib/net/telnet.rb (Net::Telnet#close): added. patched by Erik Hollensbe [ruby-dev:42260] #3830

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

History

#1

Updated by erikh (Erik Hollensbe) almost 9 years ago

=begin
Included are two patches which may be alternatives to the MM approach above:

1) Doc patch which clarifies the use of the 'sock' accessor to close the socket.

2) Simple close method which calls @sock.close.

They are mutually exclusive and support the problem in different ways.

=end

#2

Updated by naruse (Yui NARUSE) over 8 years ago

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

=begin
This issue was solved with changeset r29544.
Kiyoto, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF