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

Submitter:  None
Submitted:  Tue 18 Aug 2009 09:03:34 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned 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

 

(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

 

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

    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.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-12-04 bonzini Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code