Re: grep(1) bug - duplicate output lines

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 29 Sep 2023 20:37:12 UTC
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