delano / rye

Safe, parallel access to Unix shells from Ruby
http://delano.github.com/rye
MIT License
234 stars 32 forks source link

quiet and quietly not always working? #23

Open mrmarbury opened 12 years ago

mrmarbury commented 12 years ago

Hi, I have a problem with rye on SLES10.

When calling file_exists? it sometimes returns an error when the file does not exist. But since I use quiet mode and the method itself executes quitely, this shouldn't happen, I guess? Since I want to execute an action, if the file does not exist, this is kind of annoying

The Rye versions I've tried so far are 0.9.6 and 0.9.7. The Ruby version is 1.9.3p125

Interesting thing is that it's working with SLES 11 and the exact same versions of ruby and rye.

The way I'm using it is this:

if ssh.file_exists? config_file + "." + suffix
  false
else
  true
end

When calling Rye::Box.new, I'm setting quiet: true

Maybe you have an idea?

Thx alot, Stefan

mrmarbury commented 12 years ago

I digged some more and found out the following ... It doesn't return an error, it just returns true

Here's a sequence of executions in irb that shows what's weird:

ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: /etc/apache/vhosts.d/config-ssl.conf.ORIGINAL: No such file or directory
=> true

irb(main):047:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: /etc/apache/vhosts.d/config-ssl.conf.ORIGINAL: No such file or directory
=> true

irb(main):048:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: /etc/apache/vhosts.d/config-ssl.conf.ORIGINAL: No such file or directory
=> true

irb(main):049:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: => false

irb(main):050:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: => false

irb(main):051:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: /etc/apache/vhosts.d/config-ssl.conf.ORIGINAL
=> false

irb(main):052:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: /etc/apache/vhosts.d/config-ssl.conf.ORIGINAL
=> false

irb(main):053:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: /etc/apache/vhosts.d/config-ssl.conf.ORIGINAL: No such file or directory
=> true

irb(main):054:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: /etc/apache/vhosts.d/config-ssl.conf.ORIGINAL
=> false

irb(main):055:0> ssh.file_exists? '/etc/apache/vhosts.d/config-ssl.conf.ORIGINAL'
ls: /etc/apache/vhosts.d/config-ssl.conf.ORIGINAL: No such file or directory
=> true

The file is definitely not existing on the system.

delano commented 12 years ago

Thanks for the report. The file_* commands have some funky code to work around some challenges in net-ssh/net-sftp. I'll take a look in the next release.