Bugzilla – Bug 932494
RN: grep -e behaviour does not match expected behaviour
Last modified: 2016-07-07 13:59:23 UTC
+++ This bug was initially created as a clone of Bug #921714 +++ User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2292.0 Safari/537.36 Build Identifier: when using grep -e the result given by grep versions 2.21 and 2.22 do not match up with grep version 2.14 when encountering ^@ (null) characters such as found in /proc/<pid>/cmdline . This is breaking some init scripts, in my case specifically the /etc/init.d/ceph script. Reproducible: Always Steps to Reproduce: 1.grep -e -<insert filter that will match> /proc/<pid>/cmdline && echo Found 2. 3. Actual Results: no output Expected Results: Found is output to the terminal. an example mythMedia:~ # grep --version grep (GNU grep) 2.14 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>. mythMedia:~ # grep -e -i.a /proc/6000/cmdline Binary file /proc/6000/cmdline matches mythMedia:~ # less /proc/6000/cmdline /usr/bin/ceph-mon^@-i^@a^@--pid-file^@/var/run/ceph/mon.a.pid^@-c^@/etc/ceph/ceph.conf^@--cluster^@ceph^@-f^@ microserver-1:~ # grep --version grep (GNU grep) 2.21 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>. microserver-1:~ # grep -e -i.b /proc/10209/cmdline microserver-1:~ # echo $? 1 microserver-1:~ # less /proc/10209/cmdline /usr/bin/ceph-mon^@-i^@b^@--pid-file^@/var/run/ceph/mon.b.pid^@-c^@/etc/ceph/ceph.conf^@--cluster^@ceph^@-f^@ I have no idea what else this might be breaking as grep is used quite a lot. =========================================================================== ... maybe worth a mention in the release-notes: > When using grep-2.21+ on binary files you might get less matches than before. > Use the --text option to get more matches again.
I'm going to add a general remark as follows: <section> <!-- bsc#932494 --> <title>grep Update</title> <para> grep was updated. For changes, see <filename>/usr/share/doc/packages/grep/NEWS</filename> on the installed system. </para>
Leap comes with the "old" grep...
Fixed in Leap release notes (git).
According to the comment, it is fixed.