Skip Menu |

This queue is for tickets about the Net-SSH2 CPAN distribution.

Report information
The Basics
Id: 28722
Status: resolved
Priority: 0/
Queue: Net-SSH2

People
Owner: Nobody in particular
Requestors: RYBSKEJ [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.10
Fixed in: (no value)



Subject: deprecated LIBSSH2_APINO in libssh2 0.16+ causes test suite failure
The current error is as follows: # make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/Net-SSH2....ok 1/72 # Failed test 'API date yyyymmddhhmm' # in t/Net-SSH2.t at line 33. # 'LIBSSH2_APINO' # doesn't match '(?-xism:^\d{12}$)' t/Net-SSH2....NOK 8# Looks like you failed 1 test of 72. t/Net-SSH2....dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 8 Failed 1/72 tests, 98.61% okay (less 61 skipped tests: 10 okay, 13.89%) Failed Test Stat Wstat Total Fail List of Failed ------------------------------------------------------------------------------- t/Net-SSH2.t 1 256 72 1 8 61 subtests skipped. Failed 1/1 test scripts. 1/72 subtests failed. Files=1, Tests=72, 1 wallclock secs ( 0.16 cusr + 0.08 csys = 0.24 CPU) According to the libssh2 documentation: 2007-08-03 Daniel Stenberg * include/libssh2.h: LIBSSH2_APINO is now gone, the sooner the better. This is gonna cause some pains in apps relying on it, but it is broken by design and we should not rely on it at all. Go for the LIBSSH2_VERSION_* defines instead if you need to check for versions.
Here's a patch I hacked together that should do the trick. Cheers, Doug On Tue Aug 07 17:24:15 2007, RYBSKEJ wrote: Show quoted text
> The current error is as follows: > > # make test > PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" > "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t > t/Net-SSH2....ok 1/72 > # Failed test 'API date yyyymmddhhmm' > # in t/Net-SSH2.t at line 33. > # 'LIBSSH2_APINO' > # doesn't match '(?-xism:^\d{12}$)' > t/Net-SSH2....NOK 8# Looks like you failed 1 test of 72. > t/Net-SSH2....dubious > Test returned status 1 (wstat 256, 0x100) > DIED. FAILED test 8 > Failed 1/72 tests, 98.61% okay (less 61 skipped tests: 10 > okay, > 13.89%) > Failed Test Stat Wstat Total Fail List of Failed >
------------------------------------------------------------------------------- Show quoted text
> t/Net-SSH2.t 1 256 72 1 8 > 61 subtests skipped. > Failed 1/1 test scripts. 1/72 subtests failed. > Files=1, Tests=72, 1 wallclock secs ( 0.16 cusr + 0.08 csys = 0.24 > CPU) > > > According to the libssh2 documentation: > > 2007-08-03 Daniel Stenberg > > * include/libssh2.h: LIBSSH2_APINO is now gone, the sooner the > better. This is gonna cause some pains in apps relying on it, > but it > is broken by design and we should not rely on it at all. Go > for the > LIBSSH2_VERSION_* defines instead if you need to check for > versions. >
diff -PurN Net-SSH2-0.10.orig/SSH2.xs Net-SSH2-0.10/SSH2.xs --- Net-SSH2-0.10.orig/SSH2.xs 2007-02-24 11:43:30.000000000 -0500 +++ Net-SSH2-0.10/SSH2.xs 2007-10-10 15:29:51.000000000 -0400 @@ -14,10 +14,10 @@ #include <libssh2_sftp.h> /* include public key support if available */ -#if LIBSSH2_APINO >= 200507211326 /* 0.12+ */ +#if LIBSSH2_VERSION_NUM >= 0x000c00 /* 0.12+ */ #include <libssh2_publickey.h> #define NET_SSH2_PUBLICKEY -#endif /* LIBSSH2_APINO >= 200507211326 */ +#endif /* LIBSSH2_VERSION_NUM >= 0x000c00 */ #include "const-c.inc" @@ -562,7 +562,6 @@ #define NET_SSH2_STROF1(x) #x #define NET_SSH2_STROF(x) NET_SSH2_STROF1(x) -#define LIBSSH2_APINO_STR NET_SSH2_STROF(LIBSSH2_APINO) void net_ss_debug(SV*, SV* debug) @@ -576,14 +575,12 @@ case G_SCALAR: XSRETURN_PV(LIBSSH2_VERSION); case G_ARRAY: - EXTEND(SP, 3); + EXTEND(SP, 2); ST(0) = sv_2mortal(newSVpv(LIBSSH2_VERSION, 0)); - ST(1) = sv_2mortal(newSVpv(LIBSSH2_APINO_STR, 0)); - ST(2) = sv_2mortal(newSVpv(LIBSSH2_SSH_DEFAULT_BANNER, 0)); + ST(1) = sv_2mortal(newSVpv(LIBSSH2_SSH_DEFAULT_BANNER, 0)); - XSRETURN(3); + XSRETURN(2); } -#undef LIBSSH2_APINO_STR #undef NET_SSH2_STROF #undef NET_SSH2_STROF1 diff -PurN Net-SSH2-0.10.orig/t/Net-SSH2.t Net-SSH2-0.10/t/Net-SSH2.t --- Net-SSH2-0.10.orig/t/Net-SSH2.t 2007-10-10 15:31:25.000000000 -0400 +++ Net-SSH2-0.10/t/Net-SSH2.t 2007-10-10 15:30:44.000000000 -0400 @@ -4,7 +4,7 @@ ######################### -use Test::More tests => 72; +use Test::More tests => 71; use strict; use File::Basename; @@ -25,12 +25,11 @@ ok($ssh2->banner('SSH TEST'), 'set banner'); is(LIBSSH2_ERROR_SOCKET_NONE(), -1, 'LIBSSH2_* constants'); -# (4) version +# (3) version my $version = $ssh2->version(); ok($version >= 0.11, "libSSH2 version $version > 0.11"); -my ($version2, $apino, $banner) = $ssh2->version(); +my ($version2, $banner) = $ssh2->version(); is($version, $version2, 'list version match'); -like($apino, qr/^\d{12}$/, 'API date yyyymmddhhmm'); is($banner, "SSH-2.0-libssh2_$version", "banner is $banner"); # (2) timeout
From: LAMMEL [...] cpan.org
Here's a patch that uses the new LIBSSH2_VERSION_NUM instead of LIBSSH2_APINO, which allows for easy version comparison. The apino reported by $ssh2->version is now returned as 0x001100 (for v0.17) which can be easily compared (as string) in perl. Apply with: patch -p1 < net-ssh2-0.10-noapino.patch Cheers Roland On Wed Oct 10 15:47:19 2007, DKF wrote: Show quoted text
> Here's a patch I hacked together that should do the trick. > > Cheers, > > Doug > > On Tue Aug 07 17:24:15 2007, RYBSKEJ wrote:
> > The current error is as follows: > > > > # make test > > PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" > > "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t > > t/Net-SSH2....ok 1/72 > > # Failed test 'API date yyyymmddhhmm' > > # in t/Net-SSH2.t at line 33. > > # 'LIBSSH2_APINO' > > # doesn't match '(?-xism:^\d{12}$)' > > t/Net-SSH2....NOK 8# Looks like you failed 1 test of 72. > > t/Net-SSH2....dubious > > Test returned status 1 (wstat 256, 0x100) > > DIED. FAILED test 8 > > Failed 1/72 tests, 98.61% okay (less 61 skipped tests: 10 > > okay, > > 13.89%) > > Failed Test Stat Wstat Total Fail List of Failed > >
>
------------------------------------------------------------------------------- Show quoted text
> > t/Net-SSH2.t 1 256 72 1 8 > > 61 subtests skipped. > > Failed 1/1 test scripts. 1/72 subtests failed. > > Files=1, Tests=72, 1 wallclock secs ( 0.16 cusr + 0.08 csys =
> 0.24
> > CPU) > > > > > > According to the libssh2 documentation: > > > > 2007-08-03 Daniel Stenberg > > > > * include/libssh2.h: LIBSSH2_APINO is now gone, the sooner
> the
> > better. This is gonna cause some pains in apps relying on
> it,
> > but it > > is broken by design and we should not rely on it at all. Go > > for the > > LIBSSH2_VERSION_* defines instead if you need to check for > > versions. > >
> >
Nur in Net-SSH2-0.10: build-stamp. Nur in Net-SSH2-0.10: const-c.inc. Nur in Net-SSH2-0.10: const-xs.inc. Nur in Net-SSH2-0.10: debian. Nur in Net-SSH2-0.10: install-stamp. Nur in Net-SSH2-0.10: Makefile.old. diff -u --recursive Net-SSH2-0.10.orig/SSH2.xs Net-SSH2-0.10/SSH2.xs --- Net-SSH2-0.10.orig/SSH2.xs 2007-02-24 17:43:30.000000000 +0100 +++ Net-SSH2-0.10/SSH2.xs 2007-10-29 17:24:12.000000000 +0100 @@ -15,10 +15,16 @@ /* include public key support if available */ #if LIBSSH2_APINO >= 200507211326 /* 0.12+ */ -#include <libssh2_publickey.h> #define NET_SSH2_PUBLICKEY #endif /* LIBSSH2_APINO >= 200507211326 */ +/* as of libssh2 0.17 the new LIBSSH2_VERSION_NUM is supported */ +#ifdef LIBSSH2_VERSION_NUM +#define NET_SSH2_PUBLICKEY +#endif +#ifdef NET_SSH2_PUBLICKEY +#include <libssh2_publickey.h> +#endif /* NET_SSH2_PUBLICKEY */ #include "const-c.inc" @@ -562,7 +568,11 @@ #define NET_SSH2_STROF1(x) #x #define NET_SSH2_STROF(x) NET_SSH2_STROF1(x) -#define LIBSSH2_APINO_STR NET_SSH2_STROF(LIBSSH2_APINO) +#ifdef LIBSSH2_VERSION_NUM +#define LIBSSH2_VERSION_NUM_STR NET_SSH2_STROF(LIBSSH2_VERSION_NUM) +#else +#define LIBSSH2_VERSION_NUM_STR NET_SSH2_STROF(LIBSSH2_APINO) +#endif void net_ss_debug(SV*, SV* debug) @@ -578,7 +588,7 @@ case G_ARRAY: EXTEND(SP, 3); ST(0) = sv_2mortal(newSVpv(LIBSSH2_VERSION, 0)); - ST(1) = sv_2mortal(newSVpv(LIBSSH2_APINO_STR, 0)); + ST(1) = sv_2mortal(newSVpv(LIBSSH2_VERSION_NUM_STR, 0)); ST(2) = sv_2mortal(newSVpv(LIBSSH2_SSH_DEFAULT_BANNER, 0)); XSRETURN(3); } diff -u --recursive Net-SSH2-0.10.orig/t/Net-SSH2.t Net-SSH2-0.10/t/Net-SSH2.t --- Net-SSH2-0.10.orig/t/Net-SSH2.t 2007-02-24 16:27:18.000000000 +0100 +++ Net-SSH2-0.10/t/Net-SSH2.t 2007-10-29 17:32:05.000000000 +0100 @@ -30,7 +30,7 @@ ok($version >= 0.11, "libSSH2 version $version > 0.11"); my ($version2, $apino, $banner) = $ssh2->version(); is($version, $version2, 'list version match'); -like($apino, qr/^\d{12}$/, 'API date yyyymmddhhmm'); +like($apino, qr/^0x[0-9a-f]{6}$/ || qr/^\d{12}$/, 'API version matches 0xMMmmpp or yyyymmddhhmm$'); is($banner, "SSH-2.0-libssh2_$version", "banner is $banner"); # (2) timeout
Fixed in 0.18. I elected to use LIBSSH2_VERSION_NUM in place of LIBSSH2_APINO, without even looking at the comments or patch attached to this bug. Test also updated.