Thread: [Ssh-sftp-perl-users] Net SSH2 scp_get/scp_put problems.
Brought to you by:
dbrobins
From: Rutger O. <ov...@us...> - 2006-02-11 16:18:33
|
I've been trying out Net SSH2: http://search.cpan.org/~dbrobins/Net-SSH2-0.06/ I installed: openssl-0.9.8a.tar.gz libssh2-0.12.tar.gz But scp_get does not work on files > 25k or so. For a 2k file, it works, but larger files receive a segmentation fault. scp_put just creates a 0 byte file on the remote system but doesn't transfer the contents. Any hints on why these fail? #-- my $ssh2 = Net::SSH2->new(); $ssh2->connect("shell.sourceforge.net"); $ssh2->auth_publickey(...); $ssh2->scp_get('/home/../file', '/home/../file'); #-- When I strace the script on scp_get, I receive: send(3, ",\27\331\264\26\v\f\222Q\34\311\274\331>\256\'\337$Sw\361"..., 52, 0x4000) = 52 fcntl64(3, F_SETFL, O_RDONLY) = 0 getpid() = 10697 getpid() = 10697 send(3, "V\277\10&k\350>\231\262\360e]\204\226\245V\272\373\305"..., 52, 0x4000) = 52 --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV +++ I was connected to shell.sourceforge.net which advertises SSH-1.99-OpenSSH_3.6.1p2. Transferring the file with normal command line "scp" works. |
From: Rutger O. <ov...@us...> - 2006-02-16 19:27:50
|
Saturday, February 11, 2006, 8:18:21 AM, you wrote: RO> But scp_get does not work on files > 25k or so. For a 2k file, it works, but RO> larger files receive a segmentation fault. RO> scp_put just creates a 0 byte file on the remote system but doesn't transfer the contents. I found the scp_get problem; the pv_buffer was being incremented and then accessed at an incorrect position. (Requires a recompile of SSH2.xs). The scp_put problem was patched by by R. Corbridge. stat[2] was being used rather than stat[7] in SSH2.pm. --- diff -r -u Net-SSH2-0.06-orig/SSH2.xs Net-SSH2-0.06/SSH2.xs --- Net-SSH2-0.06-orig/SSH2.xs 2005-11-29 19:54:08.000000000 -0800 +++ Net-SSH2-0.06/SSH2.xs 2006-02-16 11:00:57.000000000 -0800 @@ -1198,7 +1198,7 @@ pv_buffer = sv_grow(buffer, size + 1/*NUL*/); /* force PV */ again: - count = libssh2_channel_read_ex(ch->channel, XLATEXT, pv_buffer, size); + count = libssh2_channel_read_ex(ch->channel, XLATEXT, pv_buffer+total, size); debug("- read %d bytes\n", count); if (count < 0) { @@ -1211,7 +1211,6 @@ total += count; if (count > 0 && (unsigned)count < size) { - pv_buffer += count; size -= count; goto again; } diff -r -u Net-SSH2-0.06-orig/lib/Net/SSH2.pm Net-SSH2-0.06/lib/Net/SSH2.pm --- Net-SSH2-0.06-orig/lib/Net/SSH2.pm 2005-11-19 10:09:54.000000000 -0800 +++ Net-SSH2-0.06/lib/Net/SSH2.pm 2006-02-16 10:39:00.000000000 -0800 @@ -339,7 +339,7 @@ $chan->blocking(1); my $buf; - my $count = $file->sysread($buf, $stat[2]); + my $count = $file->sysread($buf, $stat[7]); $self->error($!, $!), return unless defined $count; $self->error(0, "want $stat[7], have $count"), return unless $count == $stat[7]; |
From: David R. <dbr...@cp...> - 2006-02-17 03:42:55
|
On Thursday February 16, 2006 11:27, Rutger Ovidius wrote: > Saturday, February 11, 2006, 8:18:21 AM, you wrote: > > RO> But scp_get does not work on files > 25k or so. For a 2k file, it works, but > RO> larger files receive a segmentation fault. > > RO> scp_put just creates a 0 byte file on the remote system but doesn't transfer the contents. > > I found the scp_get problem; the pv_buffer was being incremented and > then accessed at an incorrect position. (Requires a recompile of SSH2.xs). Fixed for 0.07, thanks. > The scp_put problem was patched by by R. Corbridge. stat[2] was being > used rather than stat[7] in SSH2.pm. I already picked that up, it will also be in 0.07. Thanks, -- Dave Isa. 40:31 |
From: Rob V. <rob...@br...> - 2006-03-15 12:01:05
Attachments:
Net-SSH2-0.07.patch1.diff
Net-SSH2-0.07.patch2.diff
|
Hi all, I've noticed the bug for files bigger than 25k and that these still are present in the 0.07 version. I've made two patch files for these according to the fixes mentioned by Rutger Ovidius. These are almost identical to the ones from Rutger minus a couple lines that were already applied to the code. see the attachment. Regards Rob p.s. I've also build rpms for Net::SSH2 and libSSH2 which I tested on Suse 10.0 and Suse 9.1, if anybody is interested drop me an email. Op do, 16-02-2006 te 20:32 -0800, schreef David Robins: > On Thursday February 16, 2006 11:27, Rutger Ovidius wrote: > > Saturday, February 11, 2006, 8:18:21 AM, you wrote: > > > > RO> But scp_get does not work on files > 25k or so. For a 2k file, it works, but > > RO> larger files receive a segmentation fault. > > > > RO> scp_put just creates a 0 byte file on the remote system but doesn't transfer the contents. > > > > I found the scp_get problem; the pv_buffer was being incremented and > > then accessed at an incorrect position. (Requires a recompile of SSH2.xs). > > Fixed for 0.07, thanks. > > > The scp_put problem was patched by by R. Corbridge. stat[2] was being > > used rather than stat[7] in SSH2.pm. > > I already picked that up, it will also be in 0.07. > > Thanks, > |
From: David R. <dbr...@cp...> - 2006-03-16 03:33:03
|
On Wednesday March 15, 2006 04:01, Rob Verduijn wrote: > Hi all, > > I've noticed the bug for files bigger than 25k and that > these still are present in the 0.07 version. 0.07 hasn't been released yet. > I've also build rpms for Net::SSH2 and libSSH2 which I tested on Suse > 10.0 and Suse 9.1, if anybody is interested drop me an email. Great, I'm sure it will be appreciated. -- Dave Isa. 40:31 |