Red Hat Bugzilla – Bug 154515
\B in grep regular expression fails
Last modified: 2007-11-30 17:11:03 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922
Description of problem:
\B fails when preceding "--" in a grep extended-regexp
echo "--ghost" | grep -E -- '\B--ghost\b'
should output "--ghost" and have return status of '0'
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. echo "--ghost" | grep -E -- '\B--ghost\b'
Actual Results: nothing output
return status ($?) is 1
Expected Results: "--ghost" should have been output
return status ($?) should be 0
Version of grep supplied on FC3 installation CD (grep-2.5.1-31) works as expected, but the current FC3 update (grep-2.5.1-31.4) doesn't.
The bug is also present in the version supplied in FC4 test 2/3.91 (grep-2.5.1-48).
Downloading grep-2.5.1a.tar.gz from a gnu mirror and compiling from source
produces a grep that works properly (compiled on FC3).
This bug causes knock-on problems in autofs: the --ghost option, if present
in /etc/auto.master, is not passed on by the startup script (/etc/init.d/autofs)
to the automount processes it starts up. This functionality I think has only
been supported from FC3 onwards, but the grep update has broken it...
The following lines in the autofs startup script (/etc/init.d/autofs) use grep
to check for --ghost and so when the buggy versions of grep fail to detect it
(when it is there) then there won't be ghost/browsable entries under automount
if echo "$DAEMONOPTIONS $options" | grep -qE -- '\B-(g\b|-ghost\b)' ;
and an example entry in /etc/auto.master is:
/phys /etc/auto.phys --ghost
Works for me in both en_GB.UTF-8 and C locales.