Bug 154515 - \B in grep regular expression fails
\B in grep regular expression fails
Product: Fedora
Classification: Fedora
Component: grep (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2005-04-12 09:13 EDT by John Bramley
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-04-12 09:46:15 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description John Bramley 2005-04-12 09:13:09 EDT
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):

How reproducible:

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

Additional info:

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)' ;
     startupoptions="$startupoptions --ghost"

and an example entry in /etc/auto.master is:
/phys /etc/auto.phys --ghost
Comment 1 Tim Waugh 2005-04-12 09:46:15 EDT
Works for me in both en_GB.UTF-8 and C locales.

Note You need to log in before you can comment on or make changes to this bug.