Subject: | Possible setstat bug when using rput |
Date: | Tue, 2 Dec 2014 17:20:06 +0000 |
To: | "bug-Net-SFTP-Foreign [...] rt.cpan.org" <bug-Net-SFTP-Foreign [...] rt.cpan.org> |
From: | Karsten Wagner Bang <Karsten.Bang [...] ist.com> |
## System information ##
uname -a
Linux udv-karsten 3.2.0-70-generic #105-Ubuntu SMP Wed Sep 24 19:49:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi
(with 57 registered patches, see perl -V for more detail)
## Problem ##
I get the following error when I try to use $sftp->rput:
"Could not upload files: Couldn't setstat remote file: This server does not support operations to modify file attributes" and all files have size 0 on the server.my %rputoptions = (
my %rputoptions = (
copy_time => 0,
copy_perm => 0
);
$sftp->rput( $localfolder, $sftpfolder, %rputoptions)
if ( $sftp->error ) {
die "Could not establish the SFTP connection: ".$sftp->error;
}
But looping through the files myself and uploading them with $sftp->put does not return any error, and all files have the correct size:
my %rputoptions = (
copy_time => 0,
copy_perm => 0
);
for my $file ( @files ) {
next if ($file =~ m/^\./);
$sftp->put( "$localfolder/$file", "$sftpfolder/$file", %rputoptions);
if ( $sftp->error ) {
die "Could not upload file: ".$sftp->error;
}
}
The files are regular files, no folders or hidden files.
I think it might have something to do with the following code in /Net/SFTP/Foreign.pm line 2866
The option copy_perm is missing in the call to sftp->put.
if ($sftp->put($fn, $rpath,
perm => ($copy_perm ? $e->{a}->perm : 0777) & $mask,
copy_time => $copy_time,
%put_opts)) {