bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep: 'binary files' where matches are text


From: Stepan Kasal
Subject: Re: grep: 'binary files' where matches are text
Date: Fri, 7 Feb 2003 11:57:39 +0100
User-agent: Mutt/1.2.5.1i

Hello,

On Fri, Feb 07, 2003 at 10:33:44AM +0000, address@hidden wrote:
> If the user's editor is jumping straight to the line number found by grep, 
> there shouldn't be a problem.  If the user is just loading the file, then 

I was thinking about editors which have problems with binary files
(they can choke on a non-text byte, break extremely long lines, or add
a newline at the end of file).
I use vim, which is quite popular, I beleive.  It adds newline to the end,
if I accidentaly tell him to save the file (eg. by ending it :wq).

Even if the editor is able to edit binary files, the user could insert or
delete chars, which is disaster.

> >So I see no nice solution.  Perhaps the 
> ``--binary-files=print_text_matches''
> >is the best alternative.

> Perhaps.  We could think of more complex schemes like 'if all the matches 
> in a file are text, treat it as text, but if some contain binary 
> characters, treat it as binary'.  But I don't think that would be 
> particularly helpful or worth the extra complexity.

Interesting idea but I agree it's not worth the complications.

> Printing all text matches has the benefit of being simple to explain.
> 
> >But I don't know when I get to it.  Are you willing to donate a patch?
> 
> Yes, I will make a patch, but I cannot promise any particular timescale 
> myself.  Perhaps this weekend I will get around to it.

No need to hurry.  I'm afraid it'll take me much more time until I get to
it than it'll take you to write it.   ;-)

Just don't forget about it and do it when it's convenient for you.

And you'll have to sign the paperwork before the patch gets included
(in essence, assign your copyright to the donated patch to FSF).
I'll mail you the details later, but you have been warned. :-)

> I will not include 
> in my patch making the new behaviour the default, I can only suggest it 
> and leave that for you to decide.

I won't make the new behaviour the default, at least not now.
I'm too conservative and I have the concerns mentioned at the top of
this mail.
Anyone can change the default locally, via GREP_OPTIONS.

Thank you very much for your idea,
        Stepan Kasal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]