Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: salvatore.bonaccorso [...] gmail.com
Cc:
AdminCc:

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



CC: 560867-submitter [...] bugs.debian.org, 560867 [...] bugs.debian.org
Subject: can't write to remote files lines longer than 32748 chars
Date: Mon, 28 Jun 2010 22:14:14 +0200
To: bug-Net-SSH2 [...] rt.cpan.org
From: Salvatore Bonaccorso <salvatore.bonaccorso [...] gmail.com>
Hi Running the following small script hangs, when sending 32748 chars, if one CTRL-C's the files get written anyway. Sending only 32747 chars works on the other hand side well. ---(example)------------------------------------------------------------ #!/usr/bin/perl -W use strict; use Fcntl; use warnings FATAL => qw (all); use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect('hostname') or die $!; $ssh2->auth_password('username','password'); my $sftp = $ssh2->sftp(); my $remote = $sftp->open("/home/username/foo.txt", O_WRONLY | O_CREAT | O_TRUNC); print $remote 'A' x 32748; ------------------------------------------------------------------------ This was orginally in Debian a bugreport with 27442 chars, but I was not able to reproduce. I'm now with 32748. See for details [1]. [1] http://bugs.debian.org/560867 Any ideas about that? Bests Salvatore
Download signature.asc
application/pgp-signature 835b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #58911] can't write to remote files lines longer than 32748 chars
Date: Mon, 28 Jun 2010 16:35:08 -0400
To: bug-Net-SSH2 [...] rt.cpan.org
From: Rafael Kitover <rkitover [...] io.com>
I'll take a look, what happens if you split the string in half and write twice? "Salvatore Bonaccorso via RT" <bug-Net-SSH2@rt.cpan.org> wrote: Show quoted text
>Mon Jun 28 16:14:25 2010: Request 58911 was acted upon. >Transaction: Ticket created by salvatore.bonaccorso@gmail.com > Queue: Net-SSH2 > Subject: can't write to remote files lines longer than 32748 chars > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: salvatore.bonaccorso@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=58911 > > > >Hi > >Running the following small script hangs, when sending 32748 chars, if >one CTRL-C's the files get written anyway. Sending only 32747 chars >works on the other hand side well. > >---(example)------------------------------------------------------------ >#!/usr/bin/perl -W > >use strict; >use Fcntl; >use warnings FATAL => qw (all); >use Net::SSH2; > >my $ssh2 = Net::SSH2->new(); >$ssh2->debug(1); >$ssh2->connect('hostname') or die $!; >$ssh2->auth_password('username','password'); >my $sftp = $ssh2->sftp(); >my $remote = $sftp->open("/home/username/foo.txt", O_WRONLY | O_CREAT | O_TRUNC); > >print $remote 'A' x 32748; >------------------------------------------------------------------------ > >This was orginally in Debian a bugreport with 27442 chars, but I was >not able to reproduce. I'm now with 32748. See for details [1]. > > [1] http://bugs.debian.org/560867 > >Any ideas about that? > >Bests >Salvatore >
-- Sent from my Android phone with K-9. Please excuse my brevity.
CC: 560867-submitter [...] bugs.debian.org, 560867 [...] bugs.debian.org
Subject: Re: [rt.cpan.org #58911] can't write to remote files lines longer than 32748 chars
Date: Tue, 29 Jun 2010 15:38:26 +0200
To: Rafael Kitover via RT <bug-Net-SSH2 [...] rt.cpan.org>
From: Salvatore Bonaccorso <salvatore.bonaccorso [...] gmail.com>
Hi On Mon, Jun 28, 2010 at 04:35:41PM -0400, Rafael Kitover via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=58911 > > > I'll take a look, what happens if you split the string in half and write twice?
Thanks. If I split the print up into two calls, each writing 16374 chars it doesn't hang. Please let me know if I can try to provide more informations. The version currently used is 0.30 (0.30-1 package in Debian). Bests and thanks Salvatore
Download signature.asc
application/pgp-signature 835b

Message body not shown because it is not plain text.

Fixed in the development version. Now write retries until all the data is written or some error happens.
Hi, On Wed Aug 26 08:37:11 2015, SALVA wrote: Show quoted text
> Fixed in the development version. > > Now write retries until all the data is written or some error happens.
I unfortunately still can cause the behavior with the reproducer script with increased values (now). Regards, Salvatore
Subject: Re: [rt.cpan.org #58911] can't write to remote files lines longer than 32748 chars
Date: Mon, 28 Sep 2015 21:10:09 +0000 (UTC)
To: "bug-Net-SSH2 [...] rt.cpan.org" <bug-Net-SSH2 [...] rt.cpan.org>
From: Salvador Fandino <sfandino [...] yahoo.com>
Show quoted text
----- Original Message -----
> From: Salvatore Bonaccorso via RT <bug-Net-SSH2@rt.cpan.org> > To: > Cc: > Sent: Monday, September 28, 2015 6:39 PM > Subject: [rt.cpan.org #58911] can't write to remote files lines longer than 32748 chars > > Queue: Net-SSH2 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=58911 > > > Hi, > > On Wed Aug 26 08:37:11 2015, SALVA wrote:
>> Fixed in the development version. >> >> Now write retries until all the data is written or some error happens.
> > I unfortunately still can cause the behavior with the reproducer script with > increased values (now).
Oh, sorry, I didn't noticed you were talking about SFTP as a similar problem was fixed for the regular channels. Anyway, SFTP support in libssh2 is way suboptimal and particularly the libssh2_sftp_write function (which Net::SFTP::File::write wraps) has an almost impossible to use API and that can not be fixed from the Perl side. That is what you are seeing. I have just documented that on the development version of the module. My advice would be to switch to Net::SFTP::Foreign which implements the SFTP protocol fully in Perl and can also run on top of Net::SSH2 via the Net::SFTP::Foreign::Backend::Net_SSH2 module (Net::SSH2 is used only as the SSH transport layer there, the SFTP part is untouched).