in reply to Re^2: ssh2 scp question
in thread ssh2 scp question

Using your script on my Win32 box to connect to an SSH2 server on my linux box, I find that the connection is made without any trouble at all.
However, the 'scp_get' call segfaults, and I get the following error message:
libssh2_scp_recv(ss->session, path, &st) -> 0x2b849a4
If I try an 'scp_put' I get a similar message (and segfault):
libssh2_scp_send_ex(ss->session, path, mode, size, mtime, atime) -> 0x +2b8a0d4
I find that the file I tried to upload with 'scp_get' was created in the correct location on the server ... but is empty :-(
The test script that ships with the Net-SSH2 source, constructs the 'scp_get' call a little differently (though that's not the problem, afaict). It does:
my $check = IO::Scalar->new; $ssh2->scp_get($remote, $check);
I hadn't realised scp wasn't working on Windows. (I failed to notice that, since IO::Scalar was not installed, the scp tests were being skipped.) OTOH, sftp seems to work fine
I'm using Net-SSH2-0.18 on perl-5.10.

Update: Just noticed that 'scp_put' and 'scp_get' both work ok for me on perl-5.8.8, Win32. If you're using Win32, and you really do need scp, then 5.8.8 is probably the simplest way to achieve it.

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: ssh2 scp question
by dwindura (Novice) on Nov 14, 2008 at 00:53 UTC
    You might want to apply the following patch if you want to run Net::SSH2 on perl-5.10.

    http://rt.cpan.org/Public/Bug/Display.html?id=36614

    I got bitten by that bug also..
      Aaah ... good catch !!
      I thought I had already applied that patch .... and I had applied it to some of my Net-SSH2-0.18 builds, but not the particular Net-SSH2-0.18 I was using at the time :-)

      I have now applied it to all of my Net-SSH2 builds, and the OP's script now runs fine. Thanks for pointing this out.

      Cheers,
      Rob