[MacRuby] #530: Net::SSH doesn't work with MacRuby
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ It's sad to say but net-ssh (Net::SSH) doesn't work with MacRuby (yes, I did install it through macgems) for some reason, but does work fine in pure ruby. The error is below: {{{ $ macruby -v MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64] $ macirb irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'net/ssh' => true irb(main):003:0> Net::SSH.start('my-server', 'user', :password => "password") NoMethodError: protected method `initialize_ssh' called for #<TCPSocket:0x2003be380> from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/transport/packet_stream.rb:20:in `extended:' from core:in `extend:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/transport/session.rb:57:in `initialize:' from core:in `__new__:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh.rb:155:in `start:' }}} Any ideas why this is happening, and when a fix can be expected? Thanks a lot! -- Ticket URL: <http://www.macruby.org/trac/ticket/530> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by lsansonetti@…): Looks like a bug in our dispatcher. If you want a fix soon, it would help us if you could reduce the problem. -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:2> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by sk8tr1981@…): I'll be happy to help. How do I go about it? -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:3> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by eloy.de.enige@…): Please find out if the #initialize_ssh method is indeed protected or what else could be the problem. It would be very helpful if the end result of your deduction would be a simple test reproducing the problem for the test_vm suite: http://github.com/masterkain/macruby/blob/master/test_vm/dispatch.rb If the method is indeed protected and Net::SSH is using #send to circumvent it, then that's probably the problem, which has existed for a while now. In fact, in the dispatch.rb tests on line 92 you'll find a test for this problem. -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:4> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by sk8tr1981@…): Yes, the #initialize_ssh method is indeed protected, and is being called at the beginning of the packed_stream module: {{{ object.__send__(:initialize_ssh) }}} You mentioned that this problem existed for a while, could you give me a little more detail why this is happening? It would be really awesome to include net/ssh on my project, so I will help you on whatever you need (and my knowledge allows) to get this working. Cheers! -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:5> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by eloy.de.enige@…): I'll try to explain as good as I can. Protected methods may '''only''' be called without send by `self'. To circumvent this you can use #send. However, the MacRuby dispatcher code only checks whether or not the the caller is `self', but does '''not''' skip that guard in case you're using #send. The dispatch code is here: http://github.com/masterkain/macruby/blob/master/dispatcher.cpp#L401 In case you want to fix it easily so you can get on with your project, I'd suggest adding a public method which in turn calls the protected method. Thus eliminating the need for #send. Cheers! -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:6> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by sk8tr1981@…): Thanks a lot for the tips. Unfortunately after many changes and try outs Net::SSH is still not working, and other errors are popping out. After having a public method call that protected #initialize_ssh, another problem appeared, which was being called by transport/session.rb: {{{ def initialize(host, options={}) self.logger = options[:logger] ... end }}} {{{ NoMethodError: undefined method `logger=' for #<TCPSocket:0x2000e5440> from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/transport/session.rb:57:in `initialize:' from core:in `__new__:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh.rb:155:in `start:' }}} So I thought: "Ok, lets remove the logger from being called then". After doing so: {{{ NoMethodError: undefined method `e=' for -----BEGIN RSA PUBLIC KEY----- MAA= -----END RSA PUBLIC KEY----- :OpenSSL::PKey::RSA from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/buffer.rb:249:in `read_keyblob:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/buffer.rb:238:in `read_key' from core:in `each_line:' from core:in `open:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/known_hosts.rb:89:in `keys_for:' from core:in `map' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/known_hosts.rb:23:in `search_in:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/known_hosts.rb:17:in `search_for:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/transport/algorithms.rb:183:in `prepare_preferred_algorithms!' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/transport/algorithms.rb:in `initialize:' from core:in `__new__:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh/transport/session.rb:62:in `initialize:' from core:in `__new__:' from /Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.17/lib/net/ssh.rb:155:in `start:' }}} Any ideas what the next step should be? Also, how hard would it be to have MacRuby's dispatcher "work" similar to ruby's MRI, regarding #send? Thanks! -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:7> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by sk8tr1981@…): Would you have any other comments on this? -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:8> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by eloy.de.enige@…):
Any ideas what the next step should be? Also, how hard would it be to have MacRuby's dispatcher "work" similar to ruby's MRI, regarding #send?
Unfortunately, the only thing you can do right now is to find all the bugs, check if the bugs don't occur on Ruby 1.9, and file a ticket. Then try to figure out if you can work round them in the meantime. In the end, MacRuby's dispatcher should definitely do the same as MRI's, but alas some other work currently has a higher priority than the ‘protected’ problem. HTH -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:9> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by sk8tr1981@…): Yes I did test it with ruby 1.9 and it worked just fine, so clearly it's a "bug" only when I run it with MacRuby. On the other hand, I ran the same net/ssh benchmark using RubyCocoa and that worked like a charm, so I may go with them for the meantime until MacRuby becomes more "stable". Thanks! -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:10> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by lsansonetti@…): The #send problem should be fixed in r3211. Now, the snippet fails elsewhere, in my environment: {{{ $ DYLD_LIBRARY_PATH=. ./macruby -r rubygems -e "require 'net/ssh'; Net::SSH.start('localhost', 'lrz', :password => 'foo')" buffered_io.rb:in `fill': recv for buffered IO (IOError) from packet_stream.rb:in `next_packet:' from session.rb:in `poll_message:' from session.rb:in `wait' from session.rb:in `initialize:' from core:in `__new__:' from ssh.rb:in `start:' }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:11> MacRuby <http://macruby.org/>
#530: Net::SSH doesn't work with MacRuby ---------------------------------+------------------------------------------ Reporter: sk8tr1981@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by lsansonetti@…): Still fails similarly as of r4079. {{{ $ DYLD_LIBRARY_PATH=. ./macruby -r rubygems -e "require 'net/ssh'; Net::SSH.start('localhost', 'lrz', :password => 'foo')" /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.22/lib/net/ssh/buffered_io.rb:64:in `fill': recv for buffered IO (IOError) from /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.22/lib/net/ssh/transport/packet_stream.rb:85:in `next_packet:' from /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.22/lib/net/ssh/transport/session.rb:165:in `block' from /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.22/lib/net/ssh/transport/session.rb:164:in `poll_message:' from /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.22/lib/net/ssh/transport/session.rb:199:in `wait' from /Library/Frameworks/MacRuby.framework/Versions/0.7/usr/lib/ruby/Gems/1.9.0/gems /net-ssh-2.0.22/lib/net/ssh/transport/session.rb:57:in `initialize:' from /Users/lrz/src/macruby-trunk/-e:1:in `<main>' }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/530#comment:12> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby