GNU bug report logs - #21558
checking for a binary file is not deterministic

Previous Next

Package: grep;

Reported by: Benno Schulenberg <bensberg <at> justemail.net>

Date: Fri, 25 Sep 2015 09:12:01 UTC

Severity: normal

Merged with 19230, 19985, 20526

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 21558 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Benno Schulenberg <bensberg <at> justemail.net>
Cc: 21558 <at> debbugs.gnu.org
Subject: Re: bug#21558: checking for a binary file is not deterministic
Date: Fri, 25 Sep 2015 12:17:57 -0700
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 139 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.