in reply to Re^6: SSH2 for windows
in thread SSH2 for windows

Dear Rob,

Now it ran upto 22 test, after giving a secure host ip.
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.14 > 0.11 ok 7 - list version match ok 8 - API date yyyymmddhhmm ok 9 - banner is SSH-2.0-libssh2_0.14 ok 10 - poll indefinite ok 11 - poll 1/4 second To test the connection capabilities of Net::SSH2, we need a test site +running a secure shell server daemon. Enter 'localhost' to use this host. Select host [ENTER to skip]: 10.123.3.9 ok 12 - connect to 10.123.3.9 ok 13 - kex method: diffie-hellman-group-exchange-sha1 ok 14 - hostkey method: ssh-rsa ok 15 - crypt_cs method: aes256-cbc ok 16 - crypt_sc method: aes256-cbc ok 17 - mac_cs method: hmac-sha1 ok 18 - mac_sc method: hmac-sha1 ok 19 - comp_cs method: none ok 20 - comp_sc method: none ok 21 - have MD5 hostkey hash ok 22 - have SHA1 hostkey hash The getpwuid function is unimplemented at 1 line 73, <STDIN> line 1. # Looks like you planned 72 tests but only ran 22. # Looks like your test died just after 22.


Please advice

Replies are listed 'Best First'.
Re^8: SSH2 for windows
by Anonymous Monk on Dec 07, 2006 at 06:39 UTC
Re^8: SSH2 for windows
by syphilis (Archbishop) on Dec 07, 2006 at 14:04 UTC
    The getpwuid function is unimplemented at 1 line 73, <STDIN> line 1.

    You should submit a bug report to http://rt.cpan.org/Public/Dist/Display.html?Name=Net-SSH2. Test scripts should be portable- the author is probably unaware that his test script is not portable.

    As Anonymous Monk suggested, I think it is worth the effort of hacking the test script with a workaround (if possible) so that the remaining tests can be run.

    Is there anything in the test script's code that helps you with the code you're trying to write ? I've often found that test scripts provide useful examples of how to code correctly.

    Cheers,
    Rob
      Dear Rob,

      I worked around the test script and applied the required input directly into the script. Now it has ran all 72 test, But 4 tests were failed.
      Could you please let me know what would be the cause.
      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.14 > 0.11 ok 7 - list version match ok 8 - API date yyyymmddhhmm ok 9 - banner is SSH-2.0-libssh2_0.14 ok 10 - poll indefinite ok 11 - poll 1/4 second ok 12 - connect to 10.12.3.9 ok 13 - kex method: diffie-hellman-group-exchange-sha1 ok 14 - hostkey method: ssh-rsa ok 15 - crypt_cs method: aes256-cbc ok 16 - crypt_sc method: aes256-cbc ok 17 - mac_cs method: hmac-sha1 ok 18 - mac_sc method: hmac-sha1 ok 19 - comp_cs method: none ok 20 - comp_sc method: none ok 21 - have MD5 hostkey hash ok 22 - have SHA1 hostkey hash ok 23 - authenticate: publickey,password,keyboard-interactive ok 24 - list matches comma-separated ok 25 - not authenticated yet ok 26 - authenticated via: password ok 27 - authenticated successfully ok 28 - new channel isa Net::SSH2::Channel ok 29 - set blocking ok 30 - not at EOF ok 31 - normal extended data handling ok 32 - merge extended data ok 33 - empty setenv ok 34 - set environment variables ok 35 - verify session ok 36 - set disconnect callback ok 37 - SFTP session isa Net::SSH2::SFTP ok 38 - verify session ok 39 - create directory net_ssh2_2096 ok 40 - stat directory ok 41 - type is directory ok 42 - directory name matches ok 43 - put test.pl to remote ok 44 # skip - IO::Scalar required ok 45 # skip - IO::Scalar required ok 46 - unlink non-existant file fails ok 47 - got LIBSSH2_FX_NO_SUCH_FILE error ok 48 - rename net_ssh2_2096/test.pl -> net_ssh2_2096/test.pl.renamed ok 49 - stat net_ssh2_2096/test.pl.renamed ok 50 - stat filename matches ok 51 - stat filesize matches ok 52 - opened file isa Net::SSH2::File ok 53 - compare stat and fstat ok 54 - compare fstat % and %$ ok 55 - opened directory isa Net::SSH2::Dir ok 56 - found net_ssh2_2096/test.pl.renamed ok 57 - opened file isa Net::SSH2::File 'ot ok 58 - read '\# THIS LINE WILL BE READ BY A TEST BELOW '' Failed test 'read '\# THIS LINE WILL BE READ BY A TEST BELOW # in test.pl at line 184. ' got: '# THIS LINE WILL BE READ BY A TEST BELOW # expected: '# THIS LINE WILL BE READ BY A TEST BELOW' ok 59 - unlink net_ssh2_2096/test.pl.renamed ok 60 - remove directory net_ssh2_2096 ok 61 - close SFTP session ok 62 - exec 'ls -d /' not ok 63 - got poll response # Failed test 'got poll response' # in test.pl at line 196. not ok 64 - got input event # Failed test 'got input event' # in test.pl at line 197. not ok 65 - got result '/' # Failed test 'got result '/'' # in test.pl at line 199. # got: undef # expected: '/' ok 66 - no more lines ok 67 # skip - public key infrastructure not present ok 68 # skip - public key infrastructure not present ok 69 # skip - public key infrastructure not present ok 70 # skip - public key infrastructure not present ok 71 - close channel ok 72 - sent disconnect message # Looks like you failed 4 tests of 72.
        Unfortunately, I can't really help much.

        It's a bit of a worry that the exec tests failed (tests 63, 64, 65). That seems to be consistent with the failure that you reported in your initial post. I was hoping those tests would pass.

        Seems there's no-one here that is both willing and able to be of much help. Try contacting the author - and provide him with the test results and other relevant info (such as client and server OS types, and the fact that the server handles things fine from the shell). It might also be relevant that you're using a version of Net::SSH2 that has been hacked to work with perl 5.6 - so inform him of that, too. The hack is fairly simple - and can be found in the bug report at http://rt.cpan.org/Public/Bug/Display.html?id=22821

        Is it possible for you to upgrade to perl 5.8 ? It may not fix the problem, but at least it would remove any doubts regarding the validity of the hacking that has been done in order to get Net::SSH2 built for perl 5.6.

        Cheers,
        Rob
        Update:On my Mandrake Linux box (running perl 5.8.8) I have just installed OpenSSH from the installation disks. I then built and installed (on the same Linux box) libssh2-0.14 and Net-SSH2-0.09. Net-SSH2 builds and tests fine for me on that Linux box. (I ran the tests against the sshd server that's now running on the same box.)

        However, when it comes to running Net-SSH2 from my Win32 box (connecting to the sshd server on my Linux box), I get much the same as you. Actually, it's even worse with perl 5.8, than with perl 5.6, as there's a "Free to wrong pool ... " error (at the end of test 22) with perl 5.8 that kills the test suite. With perl 5.6, I get the same failures as you - plus one additional failure. For me scp_put() fails. (Any idea why that might be ?)The directory and the file both get created on my Linux box, but nothing gets written to the file. For some reason the test script also fails to exit after all of the tests have been run.

        Looks like there's a few bugs in Net-SSH2 to sort out wrt Win32 :-)