Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Net::Scp raises previous command error #26

Open
ThomasSevestre opened this issue Mar 7, 2016 · 0 comments
Open

Net::Scp raises previous command error #26

ThomasSevestre opened this issue Mar 7, 2016 · 0 comments

Comments

@ThomasSevestre
Copy link

Hello,

I have a strange behavior with net/scp. I'm using ruby 2.3.0, ssh 3.0.2, scp 1.2.1
When a command fails, the error is "stored" and reraised on valid commands.

Here is a sample script:

require "fileutils"
require "net/scp"

# remote_ip= TODO
# remote_user= TODO

connection= Net::SSH.start(remote_ip, remote_user, :keys_only => true)
scp= Net::SCP.new(connection)

# This raises "Errno::ENOENT: No such file or directory - /tmp/no_such_file"
begin
  scp.upload!("/tmp/no_such_file", "/tmp/test")
rescue => e
  puts "#{e.class}: #{e.message}"
end

FileUtils.touch("/tmp/scp_bug_file")
scp.upload!("/tmp/scp_bug_file", "/tmp/test")

I got the following error:

Errno::ENOENT: No such file or directory @ rb_file_s_stat - /tmp/no_such_file
.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:117:in `stat': No such file or directory @ rb_file_s_stat - /tmp/no_such_file (Errno::ENOENT)
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:117:in `set_current'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:24:in `upload_start_state'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp.rb:369:in `block (3 levels) in start_command'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/channel.rb:324:in `process'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:223:in `block in preprocess'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:223:in `each'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:223:in `preprocess'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:206:in `process'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:170:in `block in loop'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:170:in `loop'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/session.rb:170:in `loop'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-ssh-3.0.2/lib/net/ssh/connection/channel.rb:269:in `wait'
    from .rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/net-scp-1.2.1/lib/net/scp.rb:284:in `upload!'
    from ./test.rb:20:in `<main>'

see: net-ssh/net-ssh#53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant