From nobody Fri Sep 29 16:29:30 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RxwmF2dVLz4v78T for ; Fri, 29 Sep 2023 16:29:33 +0000 (UTC) (envelope-from jamie@catflap.org) Received: from donotpassgo.dyslexicfish.net (donotpassgo.dyslexicfish.net [IPv6:2001:19f0:7400:8808:123::1]) by mx1.freebsd.org (Postfix) with ESMTP id 4RxwmD1HmLz4WNP; Fri, 29 Sep 2023 16:29:31 +0000 (UTC) (envelope-from jamie@catflap.org) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of jamie@catflap.org designates 2001:19f0:7400:8808:123::1 as permitted sender) smtp.mailfrom=jamie@catflap.org; dmarc=pass (policy=none) header.from=catflap.org X-Catflap-Envelope-From: Received: from donotpassgo.dyslexicfish.net (donotpassgo.dyslexicfish.net [209.250.224.51]) by donotpassgo.dyslexicfish.net (8.14.5/8.14.5) with ESMTP id 38TGTUOp092230; Fri, 29 Sep 2023 17:29:30 +0100 (BST) (envelope-from jamie@donotpassgo.dyslexicfish.net) Received: (from jamie@localhost) by donotpassgo.dyslexicfish.net (8.14.5/8.14.5/Submit) id 38TGTU56092229; Fri, 29 Sep 2023 17:29:30 +0100 (BST) (envelope-from jamie) From: Jamie Landeg-Jones Message-Id: <202309291629.38TGTU56092229@donotpassgo.dyslexicfish.net> Date: Fri, 29 Sep 2023 17:29:30 +0100 Organization: Dyslexic Fish To: kevans@FreeBSD.org, jamie@catflap.org, freebsd-current@FreeBSD.org Subject: Re: grep(1) bug - duplicate output lines References: <202309280240.38S2esgN015958@donotpassgo.dyslexicfish.net> <8d0658e9-8984-a241-ad1d-e5aa1328d7fa@FreeBSD.org> In-Reply-To: <8d0658e9-8984-a241-ad1d-e5aa1328d7fa@FreeBSD.org> User-Agent: Heirloom mailx 12.4 7/29/08 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.7 (donotpassgo.dyslexicfish.net [209.250.224.51]); Fri, 29 Sep 2023 17:29:30 +0100 (BST) X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.42 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.72)[-0.717]; DMARC_POLICY_ALLOW(-0.50)[catflap.org,none]; R_SPF_ALLOW(-0.20)[+mx:dyslexicfish.net]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-current@FreeBSD.org]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; HAS_ORG_HEADER(0.00)[]; ASN(0.00)[asn:20473, ipnet:2001:19f0:7400::/38, country:US]; FREEFALL_USER(0.00)[jamie]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_NONE(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4RxwmD1HmLz4WNP Kyle Evans 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.