OK, figured it out.  I was getting my trace from some code I
put in ".../capistrano/configuration/connections.rb":

  class NilClass
    def split(*args)
      caller.each {|c| puts c }
    end
  end


My code kept the program from crashing, because split() was now
defined for NilClass.  So, a Heisenbug.


Here is a modified version:

  class NilClass
    def split(*args)
      puts "splitting Nil on '#{args[0]}', limit '#{args[1]}'"
      caller.each {|c| puts c }
      return []
    end
  end


Its output looks like:

$ cap -f ./t1.cap test_cmd
  * executing `test_cmd'
  * executing "pwd"
    servers: ["localhost"]
splitting Nil on '(?-mix:,)', limit ''
.../gems/net-ssh-2.0.1/lib/net/ssh/known_hosts.rb:101:in `keys_for'
...
/usr/local/bin/cap:18
splitting Nil on '(?-mix:,)', limit ''
.../gems/net-ssh-2.0.1/lib/net/ssh/known_hosts.rb:101:in `keys_for'
...
/usr/local/lib/ruby/gems/1.8/gems/capistrano-2.3.0/bin/cap:4
/usr/local/bin/cap:18
    [localhost] executing command
stderr from localhost: tcsh: /dev/tty: Device not configured.
stdout from localhost: /Users/rdm
    command finished


So, it appears that net-ssh is trying to split something that it
doesn't actually need.  In the process, it crashes the program.  A
bit more work revealed that the string in question came from my
'/Users/rdm/.ssh/known_hosts' file.  So I cleared it out and the
problem disappeared.


I would say that this is a bug in net-ssh, because rather than
checking for bad data and printing out a useful error message,
it hands the problem to split(), which crashes mysteriously.  It
turns out that the keys_for() routine can't handle a blank line
in the known_hosts file.  So I filed this as:

http://capistrano.lighthouseapp.com/projects/8716-capistrano/tickets/22-net-ssh-is-too-brittle

-r
-- 
http://www.cfcl.com/rdm            Rich Morin
http://www.cfcl.com/rdm/resume     [EMAIL PROTECTED]
http://www.cfcl.com/rdm/weblog     +1 650-873-7841

Technical editing and writing, programming, and web development

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to