Comment 12 for bug 1547466

Revision history for this message
Stefan Bader (smb) wrote : Re: grep switches into binary mode while processing a text file

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.