Bug 143105 - grep fails to find a match when it should
Summary: grep fails to find a match when it should
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: grep
Version: 3
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-12-16 15:42 UTC by David Alden
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-12-17 12:18:23 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description David Alden 2004-12-16 15:42:55 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3)
Gecko/20040922

Description of problem:
Hi,
  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
line:

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):
rpm-2.5.1-31.2

How reproducible:
Always

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 12:18:23 UTC
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 12:29:21 UTC
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.