[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#927992: Write errors and warnings to STDERR, don't hide them if not a tty



On Fri, Apr 26, 2019 at 11:02:42AM +0800, 積丹尼 Dan Jacobson wrote:
> Package: apt
> Version: 1.8.0
> File: /usr/bin/apt-cache
> 
> In Unix/Linux we have STDOUT and STDERR. Please just use these two,
> and don't invent "smarter ways."
> 
> Really really bad and this will come back to bite you one day:
> 
> You have a kind of message that is only shown if the user is on a tty.
> 
> You don't user the industry standard of sending it to STDERR,
> You instead just hide it... if the user apparently isn't using a TTY.
> 
> One can't even pipe the output of your program to any other program,
> expecting messages to go to STDERR. The message just disappears!
> 
> $ apt-cache show twitter-bootstrap
> N: Can't select candidate version from package twitter-bootstrap as it has no candidate
> N: Can't select versions from package 'twitter-bootstrap' as it is purely virtual
> N: No packages found
> $ apt-cache show twitter-bootstrap 2>&1|wc
>       0       0       0
> 
> In fact I can think of no other program in the entire history of Unix
> that has decided to do that.

A lot of programs do that, mostly for progress reporting. APT also lowers the
level of errors shown from WARNING to DEBUG when running interactively; effectively,
running non-interactively is the same as passing -q - just consider them progress
reports - they are not relevant to the function of the program.

These messages have not been shown at all until 2010, and then we enabled them for
interactive users in 65beb5720f82845bf175e0cd80f070da21838827. Enabling that for
non-interactive users can break stuff, so I'm not sure we want to change this.


-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en


Reply to: