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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Britton Kerin <britton.kerin <at> gmail.com>
Subject: bug#33898: closed (grep reports binary file matches even with -I
 option)
Date: Mon, 21 Jan 2019 03:45:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#33898: grep reports binary file matches even with -I option

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 33898 <at> debbugs.gnu.org.

-- 
33898: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=33898
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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 3 (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)]
[Message part 5 (message/rfc822, inline)]
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 6 (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)]

This bug report was last modified 6 years and 119 days ago.

Previous Next


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