GNU bug report logs -
#21558
checking for a binary file is not deterministic
Previous Next
Full log
View this message in rfc822 format
On 09/25/2015 11:54 AM, Benno Schulenberg wrote:
> On Fri, Sep 25, 2015, at 20:02, Paul Eggert wrote:
>> Thanks for the bug report. This appears to be basically the same as
>> Bug#20526.
> Well, not quite. That grep will see misencoded files as binary data,
> I understand. But what perplexed me is that grep would *sometimes*
> see the piped data as binary, and sometimes not. How is this possible?
Grep reads the first buffer out of the pipe and decides based on that
buffer whether the input is binary. Due to timing issues the pipe's
first buffer may contain more or fewer bytes, depending on the run. The
change proposed for Bug#20526 would change grep so that it uses a
deterministic algorithm, independent of the number of bytes it happens
to get in the first input buffer.
> If I understand it correctly, it would mean that in my example the
> piped data would never be classified as binary because the first
> grep will never output any of the misencoded bytes. Right?
>
Yes, that's the idea.
This bug report was last modified 9 years and 192 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.