http://www.perlmonks.org?node_id=956750


in reply to fsetstat no such file

Do you know which SFTP server software is being used at the remote side?

Once the file contents have been transferred, Net::SFTP calls fsetstat in order to also replicate the metadata (permissions and timestamps). But sometimes custom server software does funny things. The truth is that a "No such file or directory" is not an usual error in that context.

You can try also using Net::SFTP::Foreign instead of Net::SFTP, besides being a more feature rich client module, it also offers better debugging.

Replies are listed 'Best First'.
Re^2: fsetstat no such file
by dkellyhsu (Initiate) on Feb 28, 2012 at 20:38 UTC
    Thank you for the reply.
    I do not know the software at the remote site. I have looked at cpan site for help and found adding option "copy_perms" should disable the permission problem but when I use this I get
    Can't use string ("copy_perms") as a subroutine ref while "strict refs +" in use at /usr/lib/perl5/site_perl/5.8.5/Net/SFTP.pm line 459.
    Is there a way to not use strict refs?
      Is there a way to not use strict refs?
      Of course. If you don't want strict refs, then don't use them. Unless you tell Perl to use strict refs, Perl will not enable strict refs!

      Having said that, I doubt that disabling strict refs solves your problem. My guess? You need to put quotes around copy_perms.

      You have to write it inside quotes (i.e. 'copy_perms'), but in that case, that an argument is also required, you can use the fat arrow: copy_perms => 1.

      In any case, note that the copy_perms feature is exclusive of Net::SFTP::Foreign. Net::SFTP does not support it.

      In order to know the software used, you can just telnet to the SSH port and it will tell you. For instance:

      $ telnet localhost 22 Trying ::1... Connected to localhost.localdomain. Escape character is '^]'. SSH-2.0-OpenSSH_5.9p1 Debian-2ubuntu2
      I installed Net::SFTP::Foreign - and all now works! Thank you!