bugfindutils - Bugs: bug #31330, Possible RegEx bug in locate

 
 

bug #31330: Possible RegEx bug in locate

Submitted by:  None
Submitted on:  Thu 14 Oct 2010 02:04:15 PM UTC  
 
Category: locateSeverity: 3 - Normal
Item Group: Wrong resultStatus: Invalid
Privacy: PublicAssigned to: James Youngman <jay>
Originator Name: John MuirOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.5.9
Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 25 Oct 2010 07:51:06 AM UTC, comment #3:

Thank you for the explanation.

It seems that one must escape the backslash. This worked as I expected

locate -ir ./c/wrk/./src./grep\\..$

locate -ir .<star>/c/wrk/.<star>/src.<star>/grep\\..<star>$

John Muir <john>
Fri 15 Oct 2010 09:29:17 PM UTC, comment #2:

I'm afraid you are mistaken, as you have not correctly protected the arguments you're passing from interpretation by the shell. This point is demonstrated by the attached script which shows the same problem applying to an invocation of grep.

Essentially what's happening is that \. is interpreted by the shell as an escaped . (despite the fact that . is not special to the shell). Hence you're passing ..$ to the locate program. ..$ matches any string at least one character long.

(file #21685)

James Youngman <jay>
Project AdministratorIn charge of this item.
Thu 14 Oct 2010 02:23:53 PM UTC, comment #1:

For some reason in the description of the bug all the stars were removed when I submitted the entry (the email is OK).

The regex is

locate -ir .<star>/c/wrk/.<star>/src.<star>/grep\..<star>$

Anonymous
Thu 14 Oct 2010 02:04:15 PM UTC, original submission:

I may be mistaken, but surely the last two hits don't satisfy the regular expression?

locate -ir ./c/wrk/./src./grep\..$
/cygdrive/c/c/wrk/Grep/src/Grep.java
/cygdrive/c/c/wrk/Grep/src/GrepSimplePattern.java
/cygdrive/c/c/wrk/Grep/src/GrepVisitor.java

(cut 'n' pasted from a Cygwin window)

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #21685:  sv-31330.sh added by jay (189B - application/x-shellscript - Demonstration)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by john (Posted a comment)
  • -unavailable- added by jay (Updated the item)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 25 Oct 2010 03:19:27 PM UTCjayOpen/ClosedOpen=>Closed
    Fri 15 Oct 2010 09:29:17 PM UTCjayAttached File-=>Added sv-31330.sh, #21685
      StatusNone=>Invalid
      Assigned toNone=>jay

    Back to the top


    Powered by Savane 3.1-cleanup1