net-ssh/net-ssh — pull request #71 by HerbCSO (2012-12-23 13:26:25+00:00)
Title: Removing warnings

This pull request fixes some warnings that occur when running with -w.

The list of warnings was (path changed in the messages below):

```
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/transport/algorithms.rb:266: warning: assigned but unused variable - first_kex_packet_follows
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/buffer.rb:264: warning: assigned but unused variable - e
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/transport/openssl.rb:156: warning: assigned but unused variable - e
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/transport/key_expander.rb:25: warning: mismatched indentations at 'end' with 'module' at 2
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/transport/server_version.rb:49: warning: assigned but unused variable - e
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/transport/packet_stream.rb:218: warning: assigned but unused variable - padding
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/authentication/session.rb:73: warning: assigned but unused variable - ne
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/authentication/session.rb:57: warning: assigned but unused variable - message
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/key_factory.rb:108: warning: assigned but unused variable - type
/Path/to/.rvm/gems/ruby-1.9.3-p327/gems/net-ssh-2.6.2/lib/net/ssh/authentication/methods/keyboard_interactive.rb:45: warning: assigned but unused variable - lang_tag
```

I've tried to make appropriate changes, but not being very familiar with the codebase, I'm not sure I succeeded... ;]

Tests all pass in MRI 1.9.3 (including the port forwarding tests) and after running setup.rb the warnings disappeared on my machine.

I noticed that under MRI 1.9.2 the tests below fail, but that was happening prior to my changes already, so I don't think I introduced new problems there.

* test_load_unencrypted_private_ecdsa_sha2_nistp256_key_should_return_key
* test_load_unencrypted_private_ecdsa_sha2_nistp384_key_should_return_key
* test_load_unencrypted_private_ecdsa_sha2_nistp521_key_should_return_key

MRI 1.9.1 just doesn't seem to work at all for me, so I didn't dig much into that. I'm not sure if the current Net::SSH is still supposed to be compatible with 1.9.1.

Under JRuby-1.7.1 all the enabled tests passed, but the port forwarding tests did not all pass (see below for the list). Again, this is similar to MRI 1.9.2 in that those tests also failed prior to my changes.

* test_forward_local_unix_socket_to_remote_port
* test_loop_should_not_abort_when_local_side_of_forward_is_closed

Note that I've used the [_ (underscore) variable](http://stackoverflow.com/questions/9559561/where-and-how-is-the-underscore-variable-specified-in-ruby) to suppress warnings in `lib/net/ssh/authentication/methods/keyboard_interactive.rb` and `lib/net/ssh/key_factory.rb` since the variables they declared don't seem to be used anywhere.

I commented out the `first_kex_packet_follows` variable assignment since that seems to be part of a TODO anyway.