[Top][All Lists]

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

Re: [PATCH 1/3] grep: add --warnings={always,never,auto}.

From: Paolo Bonzini
Subject: Re: [PATCH 1/3] grep: add --warnings={always,never,auto}.
Date: Mon, 30 Aug 2010 09:47:10 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5

On 08/27/2010 08:38 PM, Paul Eggert wrote:
>  Me too, but this would be against POSIX, and I think it is also
>  borderline to remove the warning only for POSIXLY_CORRECT.

I don't understand that argument.  Is it saying that because we're
already violating POSIX unless POSIXLY_CORRECT is set,
that means it's OK to violate the GNU coding standards unconditionally?

We agree that according to POSIX grep should not print _anything_ to stderr unless it exit with an "error" status greater than 1. From chapter 1 of POSIX.2-2008 volume 3:



   Default Behavior: When this section is listed as "The standard error
   shall be used only for diagnostic messages.", it means that, unless
   otherwise stated, the diagnostic messages shall be sent to the
   standard error only when the exit status indicates that an error
   occurred and the utility is used as described by this volume of

It's true that the GNU coding standards say "please don't make the behavior of the program depend on the type of output device it is used with". On the other hand they also say "Compatibility requires certain programs to depend on the type of output device.". And when we are introducing a whole new class of diagnostic messages, I believe we must do so very carefully and avoid _completely_ ignoring this aspect of POSIX.

So, I think that the best approximation we can make is to preserve this definition when stdout is being redirected, ensuring for example that uses of grep within command substitutions won't print warnings to stderr.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]