bugzilla-daemon at mindrot.org
2003-Apr-09 16:54 UTC
[Bug 542] OpenSSH 3.6.1p1 - sftp exit codes and improved logging for scripting
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.
bugzilla-daemon at mindrot.org
2003-Apr-09 17:07 UTC
[Bug 542] OpenSSH 3.6.1p1 - sftp exit codes and improved logging for scripting
http://bugzilla.mindrot.org/show_bug.cgi?id=542 ------- Additional Comments From mouring at eviladmin.org 2003-04-10 03:07 ------- /usr/local/bin/sftp -v -oBatchMode=yes user at host -b answerfile.txt 2> debug.log use -b batch option. That is why it was created. It allows you to break when a command fails. ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
bugzilla-daemon at mindrot.org
2003-Apr-10 00:34 UTC
[Bug 542] OpenSSH 3.6.1p1 - sftp exit codes and improved logging for scripting
http://bugzilla.mindrot.org/show_bug.cgi?id=542
djm at mindrot.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
------- Additional Comments From djm at mindrot.org 2003-04-10 10:34 -------
RTFM (sftp manpage in this case):
-b batchfile
Batch mode reads a series of commands from an input batchfile
instead of stdin. Since it lacks user interaction it should be
used in conjunction with non-interactive authentication. sftp
will abort if any of the following commands fail: get, put,
rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp,
lpwd and lmkdir. Termination on error can be suppressed on a
command by command basis by prefixing the command with a ?-?
character (For example, -rm /tmp/blah* ).
And yes, -DTRACE=log in sftp-server will give you more logging.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.