jellyman has asked for the wisdom of the Perl Monks concerning the following question:

I have an application which sends data to a remiote site via sftp.

I can get to the site via sftp on the command line, and when I run my code the data makes it accross okay.

However, I get this odd warning from the module:

Couldn't fsetstat: No such file or directory at ./triggered_push.pl line 160

The code basically goes like this:
#!/usr/bin/perl use strict; use warnings; use Net::SFTP::Foreign; use Net::SFTP::Foreign::Attributes; use Net::SFTP::Foreign::Constants qw( :status ); use Net::SFTP::Foreign::Util qw( fx2txt ); use Archive::Zip qw( :ERROR_CODES ); ... my %conn_args = ( "user" => $remote_user, "port" => $remote_port, ); $sftp = Net::SFTP::Foreign->new( $remote_host, %conn_args ); ... unless ( $sftp->put( $file, $remote_file ) ) { ... error handling code ... }

The sftp->put method executes (that's the line 160 in the erorr message), but the error handling code doesn't run, and as I said the data gets sent, but my manager is a bit picky and won't let me go live without some understanding about this warning.

Is there any insight I can gain from you good people?

Replies are listed 'Best First'.
Re: odd warning from Net::SFTP::Foreign
by salva (Canon) on Jun 02, 2006 at 22:33 UTC
    The put method also copies the permissions from the local file into the remote one and for some reason that part is failing. I will look at it tomorrow.

    BTW, have you tried the development version?

    Update: I am unable to find any bug on the put method that could cause the fsetstat action to fail. Could you post here or send me an email with a listing of the permissions for the local file, and both the remote and local directories?

      listing of the local directory's content permissions:

      -rw-rw-rw- 1 webadm webadm 59 Jun 5 02:23 EXTR_LIST.txt

      listing of the local directory's permissions:

      drwxrwxrwx    2 dslusr1  dslgrp       4096 Jun  5 02:23 dsc

      listing of the remote directory's permissions:

      drwxrwsr-x 0 502 510 94 Jun 3 08:12 dundee_dsc

      listing of the remote directoriy's contents:

      -rw-rw-rw-    0 510      510           148 Jun  2 16:35 EXTR_LIST.txt

      Thanks for the help!

        I am unable to reproduce the problem. Which OS are you using on the target host?

        It would also help if you could attach a process monitor (strace, truss, ktrace, etc.) to the remote sftp server process (it is usually called sftp-server) after the ssh connection has been stablished but before the transfer starts and send me the output file.