GNU bug report logs -
#22461
problem with "Binary file messages" in latest snapshot
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Mon, 25 Jan 2016 09:21:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22461 in the body.
You can then email your comments to 22461 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-grep <at> gnu.org
:
bug#22461
; Package
grep
.
(Mon, 25 Jan 2016 09:21:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
New bug report received and forwarded. Copy sent to
bug-grep <at> gnu.org
.
(Mon, 25 Jan 2016 09:21:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I ran into this problem when using 'grep' to search through GNU Emacs installed
files. Here's how to reproduce the problem:
$ (echo xxx && yes yyy | sed 100000q && printf '\0') >big
$ grep xxx big
xxx
Binary file big matches
The last line should not be output. I'll look into fixing this.
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Mon, 01 Feb 2016 07:32:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
bug acknowledged by developer.
(Mon, 01 Feb 2016 07:32:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 22461-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I installed the attached patch, which should fix the bug, and am closing this.
[0001-Omit-excess-Binary-file-.-matches.patch (text/x-diff, attachment)]
Information forwarded
to
bug-grep <at> gnu.org
:
bug#22461
; Package
grep
.
(Mon, 01 Feb 2016 16:21:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 22461 <at> debbugs.gnu.org (full text, mbox):
On Sun, Jan 31, 2016 at 11:30 PM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
> Jim Meyering wrote:
>>
>> I looked into it and do not see a way to fix it with reasonable cost.
>> When grep finds a NUL byte, it punts on the entire block.
>
>
> Hmm, I think of it differently. When grep finds a NUL it records that the
> file is binary but if no match has been found so far, it keeps looking for
> the first match, either in the block containing the NUL or in a later block.
> In this case grep stops reading the file only after finding a match, and it
> works correctly.
>
> The problem occurs if grep finds one or more text matches before the first
> NUL: it reports those matches, records the fact that it found them, then
> sees the NUL, then stops reading that file, and then the calling code
> notices that this was (1) a binary file that (2) contained matches, so
> outputs the "Binary file ... matches" message. This is wrong, because no
> binary data actually matched.
>
> When grep finds a NUL, it should record that the file is binary and then
> look for one more match after the NUL, then quit reading the file and report
> "Binary file ... matches" only if it found that one more match.
>
> The code is complicated by the fact that the file could also be binary
> because an output line contains an encoding error, something that's detected
> in a different part of the code.
>
> Argh, I'm taking too long to explain this. It's easier to fix than to
> explain. I installed a patch; what do you think?
Oh, I see, now. Nicely done. I noticed only now that I replied to you
off-list. Didn't mean to. So am adding the bug email in Cc, so your
explanation
is recorded there.
I added one more test case:
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=43f6246fe82f1
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 01 Mar 2016 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 56 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.