Paul Eggert wrote:
On 02/02/2018 12:09 PM, L A Walsh wrote:
Grep was able to find text strings in mboxes without a POSIX
definition telling it that it was "broken".
It's not a question of POSIX telling us what to do. It's a question of
what is a good thing for GNU grep to do, and making sure that this
behavior conforms to POSIX (at least if POSIXLY_CORRECT is set).
In this case it is not.
When grep encounters binary data, there are different "good" things to
do depending on the application, so grep has options. The behavior
you're asking for is available as an option.
It also used to be the default. I still don't want it to search through a
core or executable if they happened to be in the same directory. But
email is organized in lines -- and I don't think I've ever had it
spew binary out to my screen (for an email search).
(i.e. I want it to work as it used to work, pre-posix, but still
filtering out binary files.
In this case "file" is able to determine that it is a text
file. Grep used to get it right after the option was added to
skip binary files, but before it had to be well-formed posix text.
FWIW, grep does handle at least 1 "binary case" -- when last line
doesn't have a linefeed -- something that some would like to believe
indiates binary -- but grep still handles that as text resulting in
some differing output when piped through "wc".
As I understand it, the
main point of your bug report is that you want the option to be the
default behavior. However, that would adversely affect some other common
uses of grep and it's not clear that it's a good idea.