Thread: [Ssh-sftp-perl-users] Net::SSH2 on perl 5.6
Brought to you by:
dbrobins
From: hugues <Hug...@af...> - 2006-02-03 08:51:20
|
Hello David, I've been having a look at your new Net::SSH2 module and would very much like to use that in place of Net::SSH::Perl in my application. My problem is that the production servers that will ultimately have to run the application still run under perl 5.6.0, and that probably won't change in the near future :-(( I just wanted to know if there were some fundamental reason why your module actually requires perl 5.8 or if there might be some hope to make it run under perl 5.6 too ? I've been trying just the obvious things, i.e removing all 'use 5.008' in Makefile.PL and all the .pm files, and adding a typemap entry for 'const char *' as it is defined in the default one for perl5.8 but not for perl5.6. With that mods, i managed to compile the stuff, but got stuck there: root-w2# prove -v -b t/Net-SSH2.t t/Net-SSH2....1..72 ok 1 - use Net::SSH2; ok 2 - new session isa Net::SSH2 ok 3 - error state clear ok 4 - set banner ok 5 - LIBSSH2_* constants ok 6 - libSSH2 version 0.12 > 0.11 ok 7 - list version match ok 8 - API date yyyymmddhhmm event is not of type AVPtr at blib/lib/Net/SSH2.pm line 396. ok 9 - banner is SSH-2.0-libssh2_0.12 # Looks like you planned 72 tests but only ran 9. # Looks like your test died just after 9. dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 10-72 Failed 63/72 tests, 12.50% okay Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- t/Net-SSH2.t 255 65280 72 126 175.00% 10-72 Failed 1/1 test scripts, 0.00% okay. 63/72 subtests failed, 12.50% okay. Before diving any further, i thought i might ask you if there was hope along that path, or if i'd better put all my strength in getting perl 5.8 installed on my productions servers ... Thanks anyway for both maintaining Net::SSH::Perl and providing us with that new shiny Net::SSH2 module ! -- Hugues Lafarge || Email: Hug...@af... Agence France Presse || Phone: +33 1 40 41 77 15 4 rue de la bourse, 75002 Paris || Fax: +33 1 40 41 79 24 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This e-mail, and any file transmitted with it, is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email. For more information on Agence France-Presse, please visit our web site at http://www.afp.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: David R. <dbr...@cp...> - 2006-02-03 09:44:30
|
On Friday February 3, 2006 00:51, hugues wrote: > I just wanted to know if there were some fundamental reason why your > module actually requires perl 5.8 or if there might be some hope to > make it run under perl 5.6 too ? Nothing particular, just the convenience of not having to jump through hoops and include cruft for compatibility. However, I am aware there are a lot of perl 5.6 installations out there (the last place I worked still used it; they brought in a contractor to help with upgrading to 5.8 but I don't think they actually did upgrade), and I'm willing to make Net::SSH2 work with 5.6, especially if met halfway by someone such as yourself helping with testing/changes. > I've been trying just the obvious things, i.e removing all 'use 5.008' > in Makefile.PL and all the .pm files, and adding a typemap entry for > 'const char *' as it is defined in the default one for perl5.8 but not > for perl5.6. > > With that mods, i managed to compile the stuff, but got stuck there: > > root-w2# prove -v -b t/Net-SSH2.t ... > ok 8 - API date yyyymmddhhmm > event is not of type AVPtr at blib/lib/Net/SSH2.pm line 396. I searched and found something that looks relevant: http://www.mail-archive.com/pe...@pe.../msg00982.html Looks like 5.6 doesn't like "AV *" in an XS signature and requires it be typed as an SV * and then checked/cast (a typemap entry might work there too; it would be nice if the entries added can be 5.6-only (to keep the 5.8 path cleaner), which will probably require two typemap files). > ok 9 - banner is SSH-2.0-libssh2_0.12 > # Looks like you planned 72 tests but only ran 9. > # Looks like your test died just after 9. > dubious > Test returned status 255 (wstat 65280, 0xff00) > DIED. FAILED tests 10-72 Looks like it crashed there; if you check the core file you can probably determine what happened using a debugger such as gdb or dbx by looking at the stack trace and variables. > Before diving any further, i thought i might ask you if there was hope > along that path, or if i'd better put all my strength in getting perl 5.8 > installed on my productions servers ... Sure, there is hope. I don't have any 5.6 installations myself, though, so I'll need you (and any others on the list that are interested) to test and provide patches for 5.6 compatibility. If you're able to do that, great, if not, go with the upgrade if you can :). > Thanks anyway for both maintaining Net::SSH::Perl and providing us > with that new shiny Net::SSH2 module ! Glad to contribute, thanks for the feedback. -- Dave Isa. 40:31 |
From: hugues <Hug...@af...> - 2006-02-06 10:11:56
|
>>>>> "David" == David Robins <dbr...@cp...> writes: David> On Friday February 3, 2006 00:51, hugues wrote: >> I just wanted to know if there were some fundamental reason why your >> module actually requires perl 5.8 or if there might be some hope to >> make it run under perl 5.6 too ? David> Nothing particular, just the convenience of not having to jump through hoops David> and include cruft for compatibility. David> However, I am aware there are a lot of perl 5.6 installations out there (the David> last place I worked still used it; they brought in a contractor to help with David> upgrading to 5.8 but I don't think they actually did upgrade), and I'm David> willing to make Net::SSH2 work with 5.6, especially if met halfway by someone David> such as yourself helping with testing/changes. I'm glad to hear that, and will provide any help i'm able to. >> I've been trying just the obvious things, i.e removing all 'use 5.008' >> in Makefile.PL and all the .pm files, and adding a typemap entry for >> 'const char *' as it is defined in the default one for perl5.8 but not >> for perl5.6. >> >> With that mods, i managed to compile the stuff, but got stuck there: >> >> root-w2# prove -v -b t/Net-SSH2.t David> ... >> ok 8 - API date yyyymmddhhmm >> event is not of type AVPtr at blib/lib/Net/SSH2.pm line 396. David> I searched and found something that looks relevant: David> http://www.mail-archive.com/pe...@pe.../msg00982.html David> Looks like 5.6 doesn't like "AV *" in an XS signature and requires it be typed David> as an SV * and then checked/cast (a typemap entry might work there too; it David> would be nice if the entries added can be 5.6-only (to keep the 5.8 path David> cleaner), which will probably require two typemap files). Thanks, i'll follow that path and let you know where it led me. >> ok 9 - banner is SSH-2.0-libssh2_0.12 >> # Looks like you planned 72 tests but only ran 9. >> # Looks like your test died just after 9. >> dubious >> Test returned status 255 (wstat 65280, 0xff00) >> DIED. FAILED tests 10-72 David> Looks like it crashed there; if you check the core file you can probably David> determine what happened using a debugger such as gdb or dbx by looking at the David> stack trace and variables. >> Before diving any further, i thought i might ask you if there was hope >> along that path, or if i'd better put all my strength in getting perl 5.8 >> installed on my productions servers ... David> Sure, there is hope. I don't have any 5.6 installations myself, though, so David> I'll need you (and any others on the list that are interested) to test and David> provide patches for 5.6 compatibility. If you're able to do that, great, if David> not, go with the upgrade if you can :). I'll sure be glad to help at least by testing and maybe even with providing patches if i can manage that. >> Thanks anyway for both maintaining Net::SSH::Perl and providing us >> with that new shiny Net::SSH2 module ! David> Glad to contribute, thanks for the feedback. Thank YOU. -- Hugues Lafarge || Email: Hug...@af... Agence France Presse || Phone: +33 1 40 41 77 15 4 rue de la bourse, 75002 Paris || Fax: +33 1 40 41 79 24 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This e-mail, and any file transmitted with it, is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email. For more information on Agence France-Presse, please visit our web site at http://www.afp.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
From: hugues <Hug...@af...> - 2006-02-06 19:26:23
|
>>>>> "David" =3D=3D David Robins <dbr...@cp...> writes: David> On Friday February 3, 2006 00:51, hugues wrote: >> I just wanted to know if there were some fundamental reason why your >> module actually requires perl 5.8 or if there might be some hope to >> make it run under perl 5.6 too ? David> Nothing particular, just the convenience of not having to jump t= hrough hoops=20 David> and include cruft for compatibility. David> However, I am aware there are a lot of perl 5.6 installations ou= t there (the=20 David> last place I worked still used it; they brought in a contractor = to help with=20 David> upgrading to 5.8 but I don't think they actually did upgrade), a= nd I'm=20 David> willing to make Net::SSH2 work with 5.6, especially if met halfw= ay by someone=20 David> such as yourself helping with testing/changes. >> I've been trying just the obvious things, i.e removing all 'use 5.00= 8' >> in Makefile.PL and all the .pm files, and adding a typemap entry for >> 'const char *' as it is defined in the default one for perl5.8 but n= ot >> for perl5.6. >>=20 >> With that mods, i managed to compile the stuff, but got stuck there:= =20 >>=20 >> root-w2# prove -v -b t/Net-SSH2.t=20=20 David> ... >> ok 8 - API date yyyymmddhhmm=20 >> event is not of type AVPtr at blib/lib/Net/SSH2.pm line 396.=20 David> I searched and found something that looks relevant: David> http://www.mail-archive.com/pe...@pe.../msg00982.html David> Looks like 5.6 doesn't like "AV *" in an XS signature and requir= es it be typed=20 David> as an SV * and then checked/cast (a typemap entry might work the= re too; it=20 David> would be nice if the entries added can be 5.6-only (to keep the = 5.8 path=20 David> cleaner), which will probably require two typemap files). Hi David, I've started investigating as promised, and locally modified the prototype for the net_ss__poll() function in the SSH2.xs file as advised in http://www.mail-archive.com/pe...@pe.../msg00982.html (well hopefully ;-) Here are the diffs: --- SSH2.xs.orig Wed Nov 30 04:54:08 2005 +++ SSH2.xs Mon Feb 6 20:00:57 2006 @@ -964,20 +964,23 @@ RETVAL =20 void -net_ss__poll(SSH2* ss, int timeout, AV* event) +net_ss__poll(SSH2* ss, int timeout, SV* event) PREINIT: LIBSSH2_POLLFD* pollfd; int i, count, changed; CODE: + if (! (SvRV(event) && SvTYPE(SvRV(event)) =3D=3D SVt_PVAV)) + croak("%s::poll: reference to an array expected", class); + AV* av_event =3D (AV *) SvRV(event); clear_error(ss); - count =3D av_len(event) + 1; + count =3D av_len(av_event) + 1; debug("%s::poll: timeout =3D %d, array[%d]\n", class, timeout, count); if (!(pollfd =3D malloc(sizeof(LIBSSH2_POLLFD) * count))) { set_error(ss, 0, "out of memory allocating pollfd structures"); XSRETURN_EMPTY; } for (i =3D 0; i < count; ++i) { - SV* sv =3D *av_fetch(event, i, 0/*lval*/), ** handle, ** events; + SV* sv =3D *av_fetch(av_event, i, 0/*lval*/), ** handle, ** events; HV* hv; =20 if (!SvROK(sv) || SvTYPE(SvRV(sv)) !=3D SVt_PVHV) @@ -1027,7 +1030,7 @@ XSRETURN_EMPTY; =20 for (i =3D 0; i < count; ++i) { - HV* hv =3D (HV*)SvRV(*av_fetch(event, i, 0/*lval*/)); + HV* hv =3D (HV*)SvRV(*av_fetch(av_event, i, 0/*lval*/)); hv_store(hv, "revents", 7, newSViv(pollfd[i].revents), 0/*hash*/); debug("- [%d] revents %d\n", i, pollfd[i].revents); } With this change, the module now compile and apparently passes the same tests as in perl5.8. =20 I've also checked that the changes still pass on my perl5.7. I've been stuck though at connect() time when running the t/Net-SSH2.t test file. It seems to me that there might be a typo here as the test is done via: ok($ssh2->connect($host), "connect to $host"); but i beleive that: ok($ssh2->connect($host) =3D=3D 0, "connect to $host"); would be more appropriate, at least that's the impression i get when reading both the module code and the libssh2 API documentation that says:=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - Name libssh2_session_startup =E2=80=94 start ssh2 on a socket - Synopsis #include <libssh2.h> int libssh2_session_startup(LIBSSH2_SESSION *session, int socket); Description This function starts the SSH2 protocol on an existing socket, and associates it with session.=20 On success, 0 is returned. On error, one of the errorcodes below is returned indicating the specific error that occurred.=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D So i understand that $ssh2->connect() will return 0 when succeeding. Anyway when applying the following change, i can get the tests to proceed up to the authentication phase (i will stop here for today): --- t/Net-SSH2.t.orig Wed Nov 30 04:30:52 2005 +++ t/Net-SSH2.t Mon Feb 6 20:16:14 2006 @@ -54,7 +54,7 @@ } SKIP: { # SKIP-server skip '- no server daemon available', 61 unless $host; -ok($ssh2->connect($host), "connect to $host"); +ok($ssh2->connect($host) =3D=3D 0, "connect to $host"); =20 # (8) server methods for my $type(qw(kex hostkey crypt_cs crypt_sc mac_cs mac_sc comp_cs comp_s= c)) { Thanks again for your help. --=20 Hugues Lafarge || Email: Hug...@af... Agence France Presse || Phone: +33 1 40 41 77 15 4 rue de la bourse, 75002 Paris || Fax: +33 1 40 41 79 24 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This e-mail, and any file transmitted with it, is confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this email in error, please contact the sender and delete the email from your system. If you are not the named addressee you should not disseminate, distribute or copy this email. For more information on Agence France-Presse, please visit our web site at http://www.afp.com -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |