[Top][All Lists]

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

bug#23234: unexpected results with charset handling in GNU grep 2.23

From: Eric Blake
Subject: bug#23234: unexpected results with charset handling in GNU grep 2.23
Date: Wed, 6 Apr 2016 16:33:24 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 04/06/2016 04:23 PM, Bjoern Jacke wrote:
> On 06.04.2016 23:04, Eric Blake wrote:
>> The change of treating encoding errors as binary files will NOT be
>> reverted, but here,
> hmm ... think of log files: In log files you will usually find all kind
> of encodings. If a user greps for a certain error message string in a
> log file he will not be able to find the errors because GNU grep will
> terminate grepping as soon as the first byte which does not fit into the
> locate encoding pops up.

'grep -a' is your friend.

> And what about the output of "Binary file (standard input) matches" on
> *stdout*? This is not distinguishable from a line that matched and
> contains this text. How should a script catch this situation?

That behavior complies with POSIX requirements.  Again, a script SHOULD
NOT be grepping binary files (POSIX only defines grep on text files)
without knowing the ramifications.  Meanwhile, 'grep -a' guarantees you
won't get the "Binary file" message.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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