Help me test Net::SSH2

Short story

I have released a new development version of Net::SSH2.

Help me test it, please!

Really long story

Some years ago, I started working on Net::OpenSSH. At the beginning it was just a hack, but it worked unexpectedly well and I was able to push a very perlish interface on top of it and over time it grew and become a very powerful and feature rich module and above all, very user friendly.

Just one drawback remained. Due to a limitation in OpenSSH the module, it couldn't be made to work on Windows (well, maybe now, that Microsoft is pushing OpenSSH development there...) and that bothered me. Windows users were limited to two choices: the almost impossible to install, unmaintained and buggy Net::SSH::Perl or the at that time new Net::SSH2, a wrapper around libssh2 that was quite promising but still very low level and quite hard to use.

So it occurred to me, that well, implementing all the functionality of Net::OpenSSH on top of Net::SSH2 was probably impossible. But implementing a subset, just the most useful parts could be done. I saw lots of fun ahead and couldn't resist actually doing it, and so Net::SSH::Any was born.

The idea behind Net::SSH::Any was to have a set of plugable backends providing support for the most low level SSH operations and then build other more powerful abstractions on top of that. Retrospectively I think that idea has also worked quite well. Nowadays there are three main backends (Net::SSH2, Net::OpenSSH and the Cmd backend that is able to use any binary SSH client, i.e. plink or ssh) and on top of them, Net::SSH::Any provides most of the Net::OpenSSH API and also has support for SCP and SFTP. If you are interested, I am giving a talk about Net::SSH::Any on the YAPC::Europe happening next week in Granada, Spain... by the way, Granada is an amazing place, really, if you have not signed for the conference yet and you can, just do it!

But I was talking about Net::SSH2, right?

So in the beginning I got that idea about Net::SSH::Any and after creating the basic infrastructure I went to work on the Net::SSH2 backend and was able to get something usable really fast. I released a couple of versions of Net::SSH::Any to CPAN and other people was able to use it too and everything was perfect... Well, not really. The Net::SSH2 backend was not completely reliable. Several things in Net::SSH2 were not working as expected and so I got to study Net::SSH2 source only to discover that it needed a lot of love.

Net::SSH2 had two main problems. One was that the library was missing a clear focus. Did it wanted to be a crude wrapper over the C library exposing its functionality untouched or did it wanted to be a perlish library? It was not clear, it was a mix, opportunistically perlish. Also, over time other people have submitted some patches fixing their particular problems but missing the big picture and so breaking other forms of usage. Note that I don't intend that as a critique against the module authors, on the contrary, I have been in the same situation several times and know how hard it is to get a perlish interface out of some low level C library and how easily one can come into dead ends. Just getting libssh2 wrapped was a magnificent work.

I started by untangling that, trying to recover the raw functionality of libssh2 without breaking backward compatibility and at the same time keeping sanity. I begin submitting pull request and pretty soon, Rafael Kitover, the maintainer, gave me rights on Github and in PAUSE for the module and so I was able to fix the mayor problems affecting Net::SSH::Any.

The other big problem Net::SSH2 had, the biggest actually, was libssh2 itself: it was quite buggy (again, I don't intend that as a critique against libssh2 developers, I know enough about the SSH protocol to get a good idea of how hard implementing it could be). So there was only a way out: I dug into libssh2 code and fixed the bugs that were affecting Net::SSH2 and Net::SSH::Any. Patches were promptly accepted into the master branch and then, well, then I had to wait more than a year and a half, until March this year, for a new stable release of libssh2 to come out. By that time, Net::SSH::Any was mostly dormant. My family was growing and I had little time for fun open source projects. At most I could dedicate some hours here and there and I was unhappy about it.

A couple of months ago, taking advantage of the fact that an open hackathon is being organized as part of the YAPC::Europe (did I already toll you how amazing Granada is?) I got the idea of organizing a sub-hackathon around Perl & SSH and I did... but then I also realized that just one day was too short to get where I was aiming. Some how, I have been able to convince my wife to leave me alone this week in Madrid just hacking while she is with the kids visiting her parents (heaven? well, not really, but I have to admit that I missed doing this a lot!).

And the good news are that I have been hacking on Net::SSH2 over the last days. I have closed around forty tickets. There were lots of still unresolved bugs dating from the '00s!. Now the count is down to just a handful (a couple of windows specific ones that I can't test and other related to improving the docs) no showstoppers at all, and so this afternoon I pushed a new development release to CPAN.

I have rewritten and fixed large parts of the code and it would be unrealistic to not expect regressions or other bugs coming out. There have been also some minor unavoidable backward incompatible changes introduced.

If you are an user of Net::SSH2 or are bored or just want to help, give it a go. Run the test script, try your programs or read the docs and try to use it. Testing it on Windows gives you extra points!

BTW, the module documentation is yet suboptimal, but that is outside of my auto-imposed scope. If somebody wants to volunteer for that task, I would happily be ready to clarify any doubt.

My plan next, is to fix any bugs that could appear in the coming days and to make a stable release. Then, finally, I would be able to focus on Net::SSH::Any and get also a new release out.

Leave a comment

About Salvador Fandiño

user-pic yaph