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

skip symlinks with non existing targets #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maage
Copy link

@maage maage commented Sep 9, 2015

I can test this with Linux,

test-notexisting-file.rb

require 'net/scp'

Net::SCP.upload!("localhost", "user",
    "test-dir", "net-scp-test-dir",
    :recursive => true,
    :ssh => {:keys => "~/.ssh/id_rsa", :verbose => :debug}) 

Net::SCP.upload!("localhost", "user",
    "test-dir2", "net-scp-test-dir",
    :recursive => true,
    :ssh => {:keys => "~/.ssh/id_rsa", :verbose => :debug}) 
mkdir test-dir test-dir2
cd test-dir
ln -s /notexisting-file
touch existing-file
cd ../test-dir2
ln -s /notexisting-file
cd ..
bundle exec ruby -Ilib test-notexisting-file.rb

Without this patch I get

/home/user/git/net-scp/lib/net/scp/upload.rb:117:in `stat': No such file or directory - test-dir/notexisting-file (Errno::ENOENT)
        from /home/user/git/net-scp/lib/net/scp/upload.rb:117:in `set_current'
        from /home/user/git/net-scp/lib/net/scp/upload.rb:103:in `next_item_state'
        from /home/user/git/net-scp/lib/net/scp.rb:400:in `await_response_state'
        from /home/user/git/net-scp/lib/net/scp.rb:369:in `block (3 levels) in start_command'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/channel.rb:311:in `call'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/channel.rb:311:in `process'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:223:in `block in preprocess'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:223:in `each'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:223:in `preprocess'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:206:in `process'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `block in loop'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `loop'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/session.rb:170:in `loop'
        from /home/user/git/net-scp/vendor/gems/ruby/gems/net-ssh-2.9.2/lib/net/ssh/connection/channel.rb:269:in `wait'
        from /home/user/git/net-scp/lib/net/scp.rb:284:in `upload!'
        from /home/user/git/net-scp/lib/net/scp.rb:227:in `block in upload!'
        from /home/user/git/net-scp/lib/net/scp.rb:207:in `start'
        from /home/user/git/net-scp/lib/net/scp.rb:226:in `upload!'
        from test-notexisting-file.rb:3:in `<main>'

@mfazekas
Copy link
Collaborator

@maage sorry for the late reply. Does seems to be a valid issue. Would it worth to add a flag to specify how to upload symlinks?! Should we follow them or ignore them?!

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

Successfully merging this pull request may close these issues.

2 participants