Subject: Re: bug#15773: grep-2.15 bug report

From: Jim Meyering <[email-masked]>
Date: Thu, 31 Oct 2013 20:36:42 -0700

On Thu, Oct 31, 2013 at 2:55 PM, Jim Meyering <[email-masked]> wrote:
> On Thu, Oct 31, 2013 at 10:46 AM, Mirraz Mirraz <[email-masked]> wrote:
>>
>> After updating from 2.14 to 2.15 grep has started to fail to match patterns
>> that contain '\s*' or '\s\+'
>> For example:
>>
>> (grep-2.14)
>> $ echo '[ ]' | grep '\s*'
>> [ ]
>> $
>>
>> (grep-2.15)
>> $ echo '[ ]' | grep '\s*'
>> $
>
> Thank you for the report.
> That is clearly a regression.  That is now the most compelling (of 3)
> reasons to make a new release.

Here's a preliminary patch.
I'm about to write the test suite additions to accompany it:
From 7467293d6e423d4741995fff26b4987a9b44a5c3 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Thu, 31 Oct 2013 20:20:30 -0700
Subject: [PATCH] grep: fix regression involving \s and \S

Commit v2.14-40-g01ec90b made \s and \S work with multibyte
characters, but it made it so any use like \s*, \s+, \s?, \s{3}
would malfunction.
* src/dfa.c (lex): Also reset laststart.
Reported by Mirraz Mirraz in http://bugs.gnu.org/15773.
---
 src/dfa.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/dfa.c b/src/dfa.c
index de6c671..92c410e 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -1473,6 +1473,7 @@ lex (void)

           POP_LEX_STATE ();

+          laststart = 0;
           return lasttok;

         case 'w':
-- 
1.8.4.2.564.g0d6cf24