Bug 143105 - grep fails to find a match when it should
grep fails to find a match when it should
Product: Fedora
Classification: Fedora
Component: grep (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2004-12-16 10:42 EST by David Alden
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-12-17 07:18:23 EST
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 David Alden 2004-12-16 10:42:55 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)

Description of problem:
  I was having trouble with the /etc/init.d/autofs script not setting
the timeout correctly.  I believe I've traced it down to the following

if echo "$options" | grep -qE -- '\B-(t\b|-timeout\b=)' ;

It seems that this works fine in FC2, but not in FC3.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. options="--timeout=600"
2. if echo "$options" | /bin/grep -qE -- '\B-(t\b|-timeout\b=)' ; 
then echo yes; else echo no; fi

Actual Results:  no

Expected Results:  yes

Additional info:

This script works fine on FC2 and RHEL 3U3
Comment 1 Tim Waugh 2004-12-17 07:18:23 EST
It is correct that no match is found:

#include <error.h>
#include <regex.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>

void r_error (int e, regex_t *rc)
        char msg[200];
        regerror (e, rc, msg, sizeof (msg));
        msg[sizeof (msg) - 1] = '\0';
        error (1, 0, "%s", msg);

int main ()
        int e;
        regex_t rc;
        if ((e = regcomp (&rc, "\\B-(t\\b|-timeout\\b=)", REG_EXTENDED)) != 0)
                r_error (e, &rc);
        else if ((e = regexec (&rc, "--timeout=500", 0, NULL, 0)) != 0)
                r_error (e, &rc);
        return 0;

$ make re
cc     re.c   -o re
$ ./re
./re: No match
Comment 2 David Alden 2004-12-17 07:29:21 EST
Thanks.  :-)  I guess I'll file this as a bug for the autofs folks.

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