Project

General

Profile

Actions

Bug #1041

closed

Net:SSH problem with open_channel

Added by mmucklo (Matthew Mucklo) almost 16 years ago. Updated over 13 years ago.

Status:
Third Party's Issue
Assignee:
-
ruby -v:
ruby 1.8.7 (2008-06-20 patchlevel 22) [ia64-hpux11.23]
[ruby-core:21529]

Description

=begin
It appears that the open_channel method does not always work when used without passing it a block.

Steps to reproduce:

require 'net/ssh'
ssh = Net::SSH.start('system', 'user', :password => 'password')
ch = ssh.open_channel
ch.exec 'ls' do |ch, success|
end

Resultant error:

TypeError: can't convert nil into Integer
from /usr/lib/ruby/site_ruby/1.8/net/ssh/buffer.rb:294:in pack' from /usr/lib/ruby/site_ruby/1.8/net/ssh/buffer.rb:294:in write_long'
from /usr/lib/ruby/site_ruby/1.8/net/ssh/buffer.rb:55:in send' from /usr/lib/ruby/site_ruby/1.8/net/ssh/buffer.rb:55:in from'
from /usr/lib/ruby/site_ruby/1.8/net/ssh/buffer.rb:47:in step' from /usr/lib/ruby/site_ruby/1.8/net/ssh/buffer.rb:47:in from'
from /usr/lib/ruby/site_ruby/1.8/net/ssh/connection/channel.rb:465:in send_channel_request' from /usr/lib/ruby/site_ruby/1.8/net/ssh/connection/channel.rb:159:in exec'
from (irb):9

The same does work if open_channel is passed a block, however, like such:

require 'net/ssh'
ssh = Net::SSH.start('system', 'user', :password => 'password')
channel = ssh.open_channel do |ch|
ch.exec 'ls' do |ch, success|
end
end

Also it will work if you run ssh.exec! before running ch.exec:

require 'net/ssh'
ssh = Net::SSH.start('system', 'user', :password => 'password')
ch = ssh.open_channel
ssh.exec! 'ls'
ch.exec 'ls' do |ch, success|
end


$ ruby -v
ruby 1.8.7 (2008-06-20 patchlevel 22) [ia64-hpux11.23]
$ uname -a
HP-UX srvr B.11.23 U ia64 4026996514 unlimited-user license

srvr is the name of the server


=end

Actions

Also available in: Atom PDF

Like0
Like0Like0