buggrep - Bugs: bug #27275, Wrong behaviour with GREP_USE_DFA=0

 
 

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

bug #27275: Wrong behaviour with GREP_USE_DFA=0

Submitted by:  None
Submitted on:  Tue 18 Aug 2009 09:03:34 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

Wed 31 Mar 2010 07:50:51 PM UTC, comment #3:

Bug #29394 is another example where setting GREP_USE_DFA to 0 causes incorrect matches. I'm not sure if the (Debian) patch that adds the GREP_USE_DFA environment variable is to blame, or that there is a problem in the DFA engine.

Dick Streefland <dicks>
Fri 04 Dec 2009 12:20:00 PM UTC, comment #2:

GREP_USE_DFA is not present in upstream grep (though it may be a good idea to add it).

Paolo Bonzini <bonzini>
Wed 19 Aug 2009 01:42:30 PM UTC, comment #1:

Grep 2.5.4 uses both own DFA engine and regex engine included
in GNU libc, selectively. Former supports `\s' operand, but later
doesn't. According to which engine used, the result is different.

See also following thread.
http://lists.gnu.org/archive/html/bug-grep/2009-05/msg00009.html

Where original Grep 2.5.4 doesn't interpret GREP_USE_DFA
environment variable.

Norihirio Tanaka <noritnk>
Tue 18 Aug 2009 09:03:34 AM UTC, original submission:

From Debian bug #538737. I confirmed it with version 2.5.4

http://bugs.debian.org/538737 :

"Setting the (un-documented) environment variable GREP_USE_DFA to 0 causes grep to generate incorrect results.

Start with a three line text file:
$ cat file.txt
foo <= space
foo <= tab
sfoo

Now use grep with GREP_USE_DFA set to 1. Notice correct match:
$ GREP_USE_DFA=1 grep '^\s*foo' file.txt
sfoo

Now try with GREP_USE_DFA set to 0.
$ GREP_USE_DFA=0 grep '^\s*foo' file.txt
foo <= space
foo <= tab

The program now matches the other two lines, but not the one that
should match.

This is a serious issue since disabling DFA is the default for
multi-byte encodings such as UTF-8.

You can get the same (wrong) results by setting LANG:

$ LANG=C grep '^\s*foo' file.txt
sfoo
$ LANG=en_US.UTF-8 grep '^\s*foo' file.txt
foo <= space
foo <= tab
"

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dicks (Posted a comment)
  • -unavailable- added by bonzini (Posted a comment)
  • -unavailable- added by noritnk (Posted a comment)
  •  

    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):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Dec 2009 12:20:00 PM UTCbonziniOpen/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1