[Bug 542] OpenSSH 3.6.1p1 - sftp exit codes and improved logging for scripting

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Thu Apr 10 02:54:53 EST 2003


http://bugzilla.mindrot.org/show_bug.cgi?id=542

           Summary: OpenSSH 3.6.1p1 - sftp exit codes and improved logging
                    for scripting
           Product: Portable OpenSSH
           Version: -current
          Platform: Sparc
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P2
         Component: sftp
        AssignedTo: openssh-unix-dev at mindrot.org
        ReportedBy: magnus at mandarin.nu


Overview description:
When downloading files from a remote server that are:
Non-readable (permission denied)
Non-existing (no files on remote system)
... sftp client exit-code is 0 when running the following in a script:

#!/bin/sh
/usr/local/bin/sftp -v -oBatchMode=yes user at host < answerfile.txt 2> debug.log
echo $?
0

Answerfile:
cd /var/log/testlog/test_log
get /var/log/testlog/test_log/test_log_2003-04-08.log

Debug-log produced from running above:
...snip...
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: fd 4 setting O_NONBLOCK
...snip...
Couldn't stat remote file: No such file or directory
File "/var/log/testlog/test_log/test_log_2003-04-08.lo" not found.
debug1: channel 0: read<=0 rfd 4 len 0
debug1: channel 0: read failed
...snip...
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0
...eof...

And on permission denied:
...snip...
debug1: Sending subsystem: sftp
debug1: channel 0: request subsystem
debug1: channel 0: open confirm rwindow 0 rmax 32768
Couldn't get handle: Permission denied
debug1: channel 0: read<=0 rfd 4 len 0
...snip...
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0
...eof...

Excpected results:
Shouldn't above return exit status of >0 on these errors ?

Build date and platform:
OpenSSH 3.6.1.p1, Solaris 9 sparc sun4u / GCC 3.1

Also, have you considered implementing better logging of transfers?, ex 
standard ftp "226 Transfer complete" to stdout, instead of having to run client 
in debug-mode, and perhaps a configfile to specify logpath and level.

I read in changelog about improved logging for sftp but can't see that the man-
pages are updated. What will -DTRACE=log accomplish exactly?

Thanks.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.




More information about the openssh-unix-dev mailing list