buggrep - Bugs: bug #9519, echo do^re | grep do^re; fails...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #9519: echo do^re | grep do^re; fails while grep -i do^re succeeds

Submitter:  Len Lattanzi <zardoz>
Submitted:  Thu 01 Jul 2004 05:51:05 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Mon 11 Apr 2005 10:37:59 PM UTC, comment #2: 

Fixed in CVS.  Thanks for the patch.

Julian Foad <julianfoad>
Mon 11 Apr 2005 10:27:11 PM UTC, comment #1: 

Clarification:

With grep v2.5.1, "echo do^re | grep do^re" finds no match, which is wrong, and "echo do^re | grep -i do^re" finds "do^re", which is correct.

The correct behaviour is to find a match, since plain "grep" has context-sensitive anchors: '^' is only special at the beginning of an RE or after a special '(' or '|'.

In contrast, "egrep" has context-independent anchors, so "echo do^re | egrep do^re" and "echo do^re | egrep -i do^re" should not find a match, and indeed they don't.

Julian Foad <julianfoad>
Thu 01 Jul 2004 05:51:05 AM UTC, original submission:  

===================================================================
RCS file: /cvsroot/grep/grep/src/dfa.c,v
retrieving revision 1.22
diff -u -r1.22 dfa.c
--- src/dfa.c   8 Jul 2003 14:58:05 -0000       1.22
+++ src/dfa.c   1 Jul 2004 05:46:41 -0000
@@ -1096,7 +1096,7 @@
              setbit_case_fold (c, ccl);
              return lasttok = CSET + charclass_index(ccl);
            }
-         return c;
+         return lasttok = c;
        }
     }

Len Lattanzi <zardoz>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 2 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-04-11 julianfoad StatusNone Fixed
    Open/ClosedOpen Closed

Back to the top

Powered by Savane 3.13-d3ae.
Corresponding source code