GNU bug report logs - #30326
grep not searching through a text file (thinking it binary)

Previous Next

Package: grep;

Reported by: "L. A. Walsh" <gnu <at> tlinx.org>

Date: Fri, 2 Feb 2018 19:31:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: L A Walsh <gnu <at> tlinx.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 30326-done <at> debbugs.gnu.org, GNU bug control <control <at> debbugs.gnu.org>
Subject: bug#30326: grep not searching through a text file (thinking it binary)
Date: Fri, 02 Feb 2018 15:16:49 -0800

Paul Eggert wrote:
> On 02/02/2018 12:09 PM, L A Walsh wrote:
>   
>> Grep was able to find text strings in mboxes without a POSIX
>> definition telling it that it was "broken".
>>     
>
> It's not a question of POSIX telling us what to do. It's a question of 
> what is a good thing for GNU grep to do, and making sure that this 
> behavior conforms to POSIX (at least if POSIXLY_CORRECT is set).
>   
In this case it is not.
> When grep encounters binary data, there are different "good" things to 
> do depending on the application, so grep has options. The behavior 
> you're asking for is available as an option. 
It also used to be the default.  I still don't want it to search through a
core or executable if they happened to be in the same directory.  But
email is organized in lines -- and I don't think I've ever had it
spew binary out to my screen (for an email search).

(i.e. I want it to work as it used to work, pre-posix, but still
filtering out binary files.

In this case "file" is able to determine that it is a text
file.  Grep used to get it right after the option was added to
skip binary files, but before it had to be well-formed posix text.

FWIW, grep does handle at least 1 "binary case" -- when last line
doesn't have a linefeed -- something that some would like to believe
indiates binary -- but grep still handles that as text resulting in
some differing output when piped through "wc".


> As I understand it, the 
> main point of your bug report is that you want the option to be the 
> default behavior. However, that would adversely affect some other common 
> uses of grep and it's not clear that it's a good idea.
>
>   




This bug report was last modified 7 years and 35 days ago.

Previous Next


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