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

Previous Next

Package: grep;

Reported by: Sergei Trofimovich <slyfox <at> gentoo.org>

Date: Sat, 13 Feb 2016 23:24:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ulrich Mueller <ulm <at> gentoo.org>
To: Sergei Trofimovich <slyfox <at> gentoo.org>
Cc: Jim Meyering <meyering <at> fb.com>, skvadrik <at> gmail.com, bug-grep <at> gnu.org,
 Norihiro Tanaka <noritnk <at> kcn.ne.jp>, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: grep-2.21 (and git master): --null-data and ranges work in an odd
 way (-P works fine)
Date: Sun, 14 Feb 2016 01:08:43 +0100
>>>>> On Sat, 13 Feb 2016, Sergei Trofimovich wrote:

> 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.

Hm, I think it is the other way around. \n is a normal char, so the
regex shouldn't match (and all four should return 0). In any case,
behaviour should be the same for all of them.

Downstream bug: https://bugs.gentoo.org/show_bug.cgi?id=574662

Ulrich




This bug report was last modified 8 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.