Bug 1427

Summary: scp -q behavior different than documented
Product: Portable OpenSSH Reporter: Mikel Ward <mikel>
Component: scpAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: minor CC: djm
Priority: P3    
Version: 4.7p1   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1353    
Attachments:
Description Flags
only disable the progress meter, keep error messages
none
alternative: update the man page to reflect current behavior
none
better: make -q show only critical messages in ssh and scp
none
better: make -q show only critical messages in ssh and scp none

Description Mikel Ward 2008-01-07 11:23:30 AEDT
Created attachment 1434 [details]
only disable the progress meter, keep error messages

The man page says -q disables the progress meter, but it also disables
all other output.

$ scp -q badhost:/bin/ls .

$ scp badhost:/bin/ls . 
ssh: badhost: Name or service not known

I would like -q to disable the progress meter as documented (I don't see
the point of a -q flag if all it does is discards stderr, since I can
already do that with my shell), but you might prefer to update the man
page to reflect the current behavior instead.

Tested with openssh-4.7p1 on Fedora.
Comment 1 Mikel Ward 2008-01-07 11:24:12 AEDT
Created attachment 1435 [details]
alternative: update the man page to reflect current behavior
Comment 2 Mikel Ward 2008-01-07 11:28:13 AEDT
I tested the first patch briefly.  It fixes my test case and seems to be the obvious change.

I haven't tested the second patch.  It just changes the man page.

The third option is to take a deeper look at the behavior of -q in all of OpenSSH.  My ideal would be that -q turns off things like banners but still prints errors.  That way I could run cron jobs using scp and/or ssh and only get emailed if something broke.
Comment 3 Mikel Ward 2008-01-07 11:30:38 AEDT
It seems the behavior was changed in 2003.  It used to do what the man page said, but it got changed to turn off all stderr output.  The intent was to disable banners, but it also silences any errors, which I think is undesirable.

revision 1.121
date: 2003/11/17 10:19:05;  author: djm;  state: Exp;  lines: +2 -1
   - dtucker@cvs.openbsd.org 2003/11/12 10:12:15
     [scp.c]
     When called with -q, pass -q to ssh; suppresses SSH2 banner.  ok markus@
Comment 4 Mikel Ward 2008-01-07 17:14:25 AEDT
Created attachment 1436 [details]
better: make -q show only critical messages in ssh and scp

This changes -q to suppress all messages below SYSLOG_LEVEL_FATAL.

This gives us:
- no progress bar (as documented)
- no banners (as per Darren Tucker's patch that was already committed)
- messages if the connection fails
Comment 5 Mikel Ward 2008-01-07 17:26:52 AEDT
Created attachment 1437 [details]
better: make -q show only critical messages in ssh and scp

Previous patch plus a minor change to clientloop.c just in case somebody decides to change SYSLOG_LEVEL_QUIET at a later date.
Comment 6 Damien Miller 2008-01-20 06:26:04 AEDT
The scp manual page has been updated to reflect the true behaviour. BTW I think having -q consistent between ssh and scp is desirable.
Comment 7 Damien Miller 2008-03-31 15:23:33 AEDT
Fix shipped in 4.9/4.9p1 release.