Subject: bug#23234: unexpected results with charset handling in GNU grep 2.23

From: Paul Eggert <[email-masked]>
Date: Wed, 6 Apr 2016 18:25:16 -0700

On 04/06/2016 04:15 PM, Eric Blake wrote:
> And yes, maybe we could change grep to print the "Binary file matches"
> message to stderr, but that in turn will probably break other scripts,
> and lead to even more complaints from people doing non-standard things
> and expecting consistent results.

Yes, I'm dubious about this idea. grep's behavior was inspired by diff's 
similar behavior, and grep and diff have worked that way for many years 
and I expect people depend on it. POSIX says that diff should output its 
binary-file message to stdout, and I expect that if POSIX standardized 
grep's behavior on binary files it would do something similar.

> Maybe changing the exit status when a binary file is encountered is
> worth doing

Possibly, though I don't see the use case yet. If it's needed I suggest 
doing the change only if a new option is specified 
(--binary-files=error, say) so that it's upward-compatible with existing 
behavior.