Subject: bug#22655: closed (Re: grep-2.21 (and git master): --null-data and ranges work in an odd way (-P works fine))

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 11 Apr 2016 04:50:02 +0000

Your bug report

#22655: grep-2.21 (and git master): --null-data and ranges work in an odd way (-P works fine)

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
22655: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22655
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: grep-2.21 (and git master): --null-data and ranges work in an odd way (-P works fine)
From: Paul Eggert <[email-masked]>
To: [email-masked]
Date: Sun, 10 Apr 2016 21:49:23 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

As this bug now appears to be fixed in grep master (or at least, as fixed as 
well as libpcre will allow), I'm closing it.

Subject: grep-2.21 (and git master): --null-data and ranges work in an odd way (-P works fine)
From: Sergei Trofimovich <[email-masked]>
To: [email-masked]
Cc: Jim Meyering <[email-masked]>, [email-masked], Paul Eggert <[email-masked]>, [email-masked], Norihiro Tanaka <[email-masked]>
Date: Sat, 13 Feb 2016 23:20:52 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

The issue is found by Ulrich Mueller:

It seems DFA engine does not understand --null-data:

~/dev/git/grep $ cat a-test.sh 
#!/bin/bash

printf '12\n34\0' | LC_ALL=en_US.utf-8 src/grep -z    '^[1234yz]*$'  | wc -c
printf '12\n34\0' | LC_ALL=en_US.utf-8 src/grep -P -z '^[1234yz]*$'  | wc -c
printf '12\n34\0' | LC_ALL=en_US.utf-8 src/grep -z    '^[1234y-z]*$' | wc -c
printf '12\n34\0' | LC_ALL=en_US.utf-8 src/grep -P -z '^[1234y-z]*$' | wc -c

~/dev/git/grep $ ./a-test.sh 
0
6
6
6

All 4 should return 6 but first is not correct.
It seems that 'y-z' range disables dfa.c code and works fine.

-- 

  Sergei