Bug 932494 - RN: grep -e behaviour does not match expected behaviour
Summary: RN: grep -e behaviour does not match expected behaviour
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Release Notes (show other bugs)
Version: Current
Hardware: x86-64 openSUSE 13.2
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Karl Eichwalder
QA Contact: Stephan Kulow
URL:
Whiteboard:
Keywords:
Depends on: 921714
Blocks: 949491
  Show dependency treegraph
 
Reported: 2015-05-27 13:32 UTC by Karl Eichwalder
Modified: 2016-07-07 13:59 UTC (History)
5 users (show)

See Also:
Found By: Documentation
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Eichwalder 2015-05-27 13:32:49 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.
Comment 1 Karl Eichwalder 2015-10-12 14:41:54 UTC
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>
Comment 2 Karl Eichwalder 2015-10-22 14:53:17 UTC
Leap comes with the "old" grep...
Comment 3 Karl Eichwalder 2015-10-22 14:57:53 UTC
Fixed in Leap release notes (git).
Comment 4 Karl Eichwalder 2016-07-07 13:59:23 UTC
According to the comment, it is fixed.