Skip Menu |

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

Report information
The Basics
Id: 59168
Status: resolved
Worked: 5 min
Priority: 0/
Queue: Net-SFTP-Foreign

People
Owner: salva [...] cpan.org
Requestors: brian@massassi.com (no email address)
Cc:
AdminCc:

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



Subject: rput doesn't seem to work on windows using plink/putty
plink 0.60 I'm having problems getting Net::SFTP::Foreign rput() method to work on windows. It reports success, creates the remote directory, but no files are transferred. The rput method returns success and the error() method always returns no error (0). Here is test code that demonstrates the problem: use warnings; use strict; use Net::SFTP::Foreign; my $sftp = Net::SFTP::Foreign->new( host => '<removed>', user => '<removed>', ssh_cmd => 'plink', ); die $sftp->error if $sftp->error; $sftp->rput('\Zed', '/home/<removed>/Zed') or die $sftp->error(); my $ls = $sftp->ls('/home/<removed>/Zed') or die $sftp->error(); print $_->{'filename'} . "\n" for @$ls; $sftp->disconnect(); Output: . .. I am transferring from a windows machine to a linux machine. I have used the exact code (with a changed ssh_cmd) to transfer files from linux to linux.
Hi Could you try version 1.58_06 from CPAN? Regarding error handling, "rput" (or any recursive method) does not set "error" but accepts a subroutine callback that will be called for every failed sub-operation (for instance, creating a directory, transferring a file, etc.). For instance: $sftp->rput($local, $remote, on_error => sub { my ($sftp, $e) = @_; print STDERR "error processing $e->{filename}: " . $sftp->error; } );
I tried the latest version and got the same issue. I added the error checking as suggested and for each file it emits: Bad local path (followed by the filename). I spent some time looking and it's trying to match a literal . after the base directory. I traced that to this line 2481: $local = $lfs->join($local, './'); This is later turned into a regular expression using quotemeta and then qr. When removing the "." from this join, everything seems to work. $local = $lfs->join($local, '/'); I don't quite understand what the intention of that line is. It seems to work as-is under linux but not windows. I tried various incantations of slashing and escaping under windows and could not get it to work without removing the . from the line above. I didn't have time to see if the change affects linux, but maybe this will help you debug it. Thanks for your time and this module, I appreciate it. By the way, to temporarily work around this issue I actually implemented a local File::Find loop that finds all local files in the specified local path and uploads them one by one. On Mon Jul 12 06:42:30 2010, SALVA wrote: Show quoted text
> Hi > > Could you try version 1.58_06 from CPAN? > > Regarding error handling, "rput" (or any recursive method) does not set > "error" but accepts a subroutine callback that will be called for every > failed sub-operation (for instance, creating a directory, transferring a > file, etc.). > > For instance: > > $sftp->rput($local, $remote, > on_error => sub { > my ($sftp, $e) = @_; > print STDERR "error processing > $e->{filename}: " . $sftp->error; > } );
Subject: Re: [rt.cpan.org #59168] rput doesn't seem to work on windows using plink/putty
Date: Tue, 13 Jul 2010 00:53:07 -0700 (PDT)
To: bug-Net-SFTP-Foreign [...] rt.cpan.org
From: Salvador Fandino <sfandino [...] yahoo.com>
Hi, Show quoted text
----- Original Message ----
> From: Brian E. Lozier via RT <bug-Net-SFTP-Foreign@rt.cpan.org> > Sent: Mon, July 12, 2010 7:21:23 PM > Subject: [rt.cpan.org #59168] rput doesn't seem to work on windows using >plink/putty > > > Queue: Net-SFTP-Foreign > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=59168 > > > I tried the latest version and got the same issue. I added the error > checking as suggested and for each file it emits: Bad local path > (followed by the filename).
I am unable to reproduce the problem. Could you include the program you are using? Also, could you check that it is using the latest development version of the module (1.58_06): print $Net::SFTP::Foreign::VERSION; - Salva
As no feedback has been received on this report for more than a month and it works for me I am closing it. Feel free to reopen it if you are able to provide new information. Cheers, - Salva