Bug 1427 - scp -q behavior different than documented
Summary: scp -q behavior different than documented
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: scp (show other bugs)
Version: 4.7p1
Hardware: All All
: P3 minor
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_4_8
  Show dependency treegraph
 
Reported: 2008-01-07 11:23 AEDT by Mikel Ward
Modified: 2008-03-31 15:23 AEDT (History)
1 user (show)

See Also:


Attachments
only disable the progress meter, keep error messages (524 bytes, patch)
2008-01-07 11:23 AEDT, Mikel Ward
no flags Details | Diff
alternative: update the man page to reflect current behavior (569 bytes, patch)
2008-01-07 11:24 AEDT, Mikel Ward
no flags Details | Diff
better: make -q show only critical messages in ssh and scp (2.19 KB, patch)
2008-01-07 17:14 AEDT, Mikel Ward
no flags Details | Diff
better: make -q show only critical messages in ssh and scp (2.91 KB, patch)
2008-01-07 17:26 AEDT, Mikel Ward
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.