On 08/30/10 00:47, Paolo Bonzini wrote: > 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."
But in this case we're talking about new behavior. No other grep implementation outputs warnings for dubious-but-POSIXLY-correct patterns, right? So there's no issue about compatibility with other greps. How about this idea instead? If POSIXLY_CORRECT is set, output no warnings and behave as grep has done for ages. Otherwise, if a dubious regular expression is found, output a diagnostic and exit with status 2. The documentation should explicitly state that dubious regular expressions are errors unless POSIXLY_CORRECT is set. This satisfies the the GNU coding standards and conforms to POSIX, and it should work well in practice.
