The difference is that grep -a treats the NUL byte as text, whereas 
    LC_ALL=C grep treats it as binary. 

I see.  Thanks for the explanation.

    The latter has been longstanding behavior for quite some time.

I surmise it has not hit many distros yet.

It's problematic because it means any script that wants to grep an
arbitrary file can't do so without resorting to checking if the grep at
hand supports -a which is IMHO an impractical amount of pain for a 
Unix utility that is used everywhere.

I personally have had to refrain from updating grep for some versions
now because of this.  There's no way to predict what will break,
because NUL bytes can easily get written "by accident" into an
otherwise-text file at any time.  Like a log.

I reiterate my request for a configure option.  Or changing LC_ALL=C
behavior to really be like -a.  What are you gaining by this special
treatment of NUL?  --thanks, k.



Reply via email to