Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Sep 2023 17:29:30 +0100
From:      Jamie Landeg-Jones <jamie@catflap.org>
To:        kevans@FreeBSD.org, jamie@catflap.org, freebsd-current@FreeBSD.org
Subject:   Re: grep(1) bug - duplicate output lines
Message-ID:  <202309291629.38TGTU56092229@donotpassgo.dyslexicfish.net>
In-Reply-To: <8d0658e9-8984-a241-ad1d-e5aa1328d7fa@FreeBSD.org>
References:  <202309280240.38S2esgN015958@donotpassgo.dyslexicfish.net> <8d0658e9-8984-a241-ad1d-e5aa1328d7fa@FreeBSD.org>

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

Kyle Evans <kevans@FreeBSD.org> wrote:

> I think this is what we want:
>
> https://people.freebsd.org/~kevans/grep-color.diff

Brilliant! Thanks for the quick response and fix. It works fine for me -
I've not managed to break it again :-)

> Basically, for --color with . we actually get each individual character 
> reported, and we can't really coalesce that. (Well, we could, but I'll 
> leave that for future improvement). Once you hit 32 matches in the same 
> line, we dump out the first set of matches then check again for any more
> that just didn't fit the first time. Unfortunately, that logic wasn't 
> prepared to avoid terminating the first time in case we have more 
> matches to output, so we'd terminate, then refill our matches with the 
> remainder of the line and output the leading context again + terminate 
> again.

Ahh, hence the 'chunks' of coloured sections, and the fact that the longer
the line, the more times it was repeated.

Will this be MFC'd to 13 and 14?

Thanks again, Jamie.


help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309291629.38TGTU56092229>