GNU bug report logs - #33898
grep reports binary file matches even with -I option

Previous Next

Package: grep;

Reported by: Britton Kerin <britton.kerin <at> gmail.com>

Date: Fri, 28 Dec 2018 22:45:01 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 33898 in the body.
You can then email your comments to 33898 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#33898; Package grep. (Fri, 28 Dec 2018 22:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Britton Kerin <britton.kerin <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Fri, 28 Dec 2018 22:45:02 GMT) Full text and rfc822 format available.

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

From: Britton Kerin <britton.kerin <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: grep reports binary file matches even with -I option
Date: Fri, 28 Dec 2018 13:25:23 -0900
[Message part 1 (text/plain, inline)]
The man page description of the -I option implies that grep might
output match information for a
binary file if it hasn't "discovered" that the file is binary yet.  It
seems that even with -I Binary file
matches may be reported, as this example on the attached file shows:

$ 'grep' -I -e '.' bca9b83eeb33810a61cca0485f504f98540156
Binary file bca9b83eeb33810a61cca0485f504f98540156 matches

This seems like a bug, because it's clearly produced at a point when
grep has already decided the
file is binary, and scripts can reasonably expect that any matches
that do occur in a
so-far-unknown-to-be-binary file will conform to the output format
specified by other other options (e.g. -n) and feature an actual file
name.

Britton
[bca9b83eeb33810a61cca0485f504f98540156 (application/octet-stream, attachment)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 21 Jan 2019 03:45:02 GMT) Full text and rfc822 format available.

Notification sent to Britton Kerin <britton.kerin <at> gmail.com>:
bug acknowledged by developer. (Mon, 21 Jan 2019 03:45:02 GMT) Full text and rfc822 format available.

Message #10 received at 33898-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Britton Kerin <britton.kerin <at> gmail.com>
Cc: 33898-done <at> debbugs.gnu.org
Subject: grep reports binary file matches even with -I option
Date: Sun, 20 Jan 2019 19:43:55 -0800
[Message part 1 (text/plain, inline)]
Thanks for reporting the problem. This is a bug in grep's man page, which wasn't 
updated back in 2016 when I updated the main documentation. (The man page is 
lower priority and is sometimes neglected.) I installed the attached patch to 
fix it.
[0001-doc-binary-files-update-in-man-page.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 18 Feb 2019 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 40 days ago.

Previous Next


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