Bug 154515 - \B in grep regular expression fails
Summary: \B in grep regular expression fails
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: grep
Version: 3
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-04-12 13:13 UTC by John Bramley
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-04-12 13:46:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description John Bramley 2005-04-12 13:13:09 UTC
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):
grep-2.5.1-31.4

How reproducible:
Always

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 
mount-points.

if echo "$DAEMONOPTIONS $options" | grep -qE -- '\B-(g\b|-ghost\b)' ;
then
     startupoptions="$startupoptions --ghost"
fi

and an example entry in /etc/auto.master is:
/phys /etc/auto.phys --ghost

Comment 1 Tim Waugh 2005-04-12 13:46:15 UTC
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.