arn...@skeeve.com wrote:
this is a case where meeting user expectations should outweigh being POSIXly correct.
This issue is independent of POSIXLY_CORRECT, since POSIX does not specify what 'grep' should do when given non-text input. Portable scripts cannot rely on grep's default behavior here, as different grep implementations behave quite differently. Some even dump core (which POSIX allows!).
Just think how it will cut down the number of bug reports about this
If only it would! But I'm afraid we'd start getting bug reports from the other side of the issue.
Anyway, as noted in Bug#22838 the heuristic has recently (post-2.5) been jogged in the direction that I think you prefer, and perhaps that will be good enough even if it's not exactly what you asked for. See:
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=bf3ee23890db33e3d0bef5344e896d2cdfaa34aa