GNU bug report logs - #19242
latest grep considers text files as binary

Previous Next

Package: grep;

Reported by: Thomas Wolff <towo <at> computer.org>

Date: Mon, 1 Dec 2014 18:02:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


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

From: Eric Blake <eblake <at> redhat.com>
To: Jim Meyering <jim <at> meyering.net>, Thomas Wolff <towo <at> computer.org>
Cc: Jim Meyering <meyering <at> fb.com>, Paul Eggert <eggert <at> cs.ucla.edu>,
 19242 <at> debbugs.gnu.org
Subject: Re: bug#19242: latest grep considers text files as binary
Date: Fri, 05 Dec 2014 08:36:17 -0700
[Message part 1 (text/plain, inline)]
On 12/05/2014 08:00 AM, Jim Meyering wrote:

>>
>> I deny this is desirable behavior and I doubt there is a security issue as
>> described. If any other, independent software has a security issue with
>> non-UTF-8 input, it should decide itself to filter it and use accordingly
>> stable decoding functions. It cannot be the task of any tool (grep in this
>> case) to filter output to work around possible security issues in other
>> programs in a pipe. This would be completely against the concept of pipes in
>> the Unix tradition.
> 
> This is another side effect of using a multibyte locale.
> As long as there are no NUL bytes in your input, you can work
> around the issue by running grep in the C locale:
> 
>   LC_ALL=C grep ...

Yes, the C locale has the nice effect of EVERY byte being a valid single
byte character, leaving only NUL bytes and a non-empty file not ending
in newline as the only reasons for a file to be marked binary.

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

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 10 years and 64 days ago.

Previous Next


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