Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Sep 2023 15:37:12 -0500
From:      Kyle Evans <kevans@FreeBSD.org>
To:        Jamie Landeg-Jones <jamie@catflap.org>, freebsd-current@FreeBSD.org
Subject:   Re: grep(1) bug - duplicate output lines
Message-ID:  <85039cfe-3c59-173d-f2f2-f0ca8e0fa1c8@FreeBSD.org>
In-Reply-To: <202309291825.38TIPNN2096338@donotpassgo.dyslexicfish.net>
References:  <202309280240.38S2esgN015958@donotpassgo.dyslexicfish.net> <8d0658e9-8984-a241-ad1d-e5aa1328d7fa@FreeBSD.org> <202309291629.38TGTU56092229@donotpassgo.dyslexicfish.net> <202309291825.38TIPNN2096338@donotpassgo.dyslexicfish.net>

index | next in thread | previous in thread | raw e-mail

On 9/29/23 13:25, Jamie Landeg-Jones wrote:
> Jamie Landeg-Jones <jamie@catflap.org> wrote:
> 
>> Brilliant! Thanks for the quick response and fix. It works fine for me -
>> I've not managed to break it again :-)
> 
> Famous last words....
> 
> "grep -v" now produces duplicate lines! e.g. :
> 

Alright, fine, be that way. :-) Try this on top of the existing patch:

https://people.freebsd.org/~kevans/grep-color.diff

I forgot that -v means it's valid to enter procmatch_match with no 
matches because that's the very definition of the -v flag.  As such, we 
need to specifically avoid the trailing printline() with the vflag 
because we already terminated in the first printline().

It also removes the offending code that made me overlook that scenario.

Thanks,

Kyle Evans



help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?85039cfe-3c59-173d-f2f2-f0ca8e0fa1c8>