Subject: Re: bug#73360: Error when a long list is provided to grep with "--binary-files=without-match" option

From: Paul Eggert <[email-masked]>
Date: Fri, 20 Sep 2024 22:41:40 -0700

On 2024-09-20 07:22, Rodrigo Jorge wrote:
> Can I run those 2 grep commands with some sort of debug flag and send them
> back for analysis? The file list is exactly the same, just changing the
> file order.

Unfortunately there's no debug flag. Of course you can run grep under 
GDB but it will require some expertise to puzzle out why the last two 
files are treated differently.

Do you see the same problem if you run in the C locale? That is, set 
LC_ALL="C" in the environment.

What does 'strace' say about grep's reading of the two files in 
question? Can you give the strace output for just those two files?

I have the sneaking suspicion that the script is assuming properties of 
'grep' that are not documented and that are not guaranteed.  grep -I's 
heuristic for determining whether a file is "binary" is designed for 
that particular grep run, and does not necessarily agree with what other 
programs think are "binary files", or even what other instances of 
'grep' think are "binary files". The strace output might help clear up 
whether this is what is happening.