[Bug 1547466] Re: grep switches into binary mode while processing a text file

Stefan Bader stefan.bader at canonical.com
Wed Mar 9 07:13:15 UTC 2016


While it is good to have the builders fixed, there is one worrying
aspect to this: this may happen to anything using grep and modifies the
output in an unexpected way while still returning a zero return code.
For example:

echo -e "Hello\nWörld" | LANG=C grep -v xxx; echo $?

will no longer return both input lines (note the German umlaut ö) but
stop at the second line (even if there were more), print a "binary ...
matches" and return with 0. So having the grep passing its output to
another pipe, there is no way to tell it is going wrong. Given that it
is not uncommon to set a LANG=C in scripts (as one then knows what
output language text messages will have) and potentially might be used
to parse file lists (where file names may have special characters) it is
hard to predict how much breakage this may cause.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grep in Ubuntu.
https://bugs.launchpad.net/bugs/1547466

Title:
  grep switches into binary mode while processing a text file

Status in grep package in Ubuntu:
  Confirmed

Bug description:
  I noticed this staring to happen in Xenial about two days ago. When
  running sbuild (or now the buildd, too), the build breaks when trying
  to compile a generated file. I traced the problem down to grep
  suddenly acting weird. When not having any language set (or a non-UTF8
  mode) it will start printing some lines of a source file and then
  suddenly end that by printing "Binary file ... matches".

  With the attached file, the difference can be observed (running
  Xenial):

  LANG=C grep -v xxx grant_table.h

  and

  LANG=C.UTF-8 grep -v xxx grant_table.h

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grep/+bug/1547466/+subscriptions



More information about the foundations-bugs mailing list