From nobody Fri Sep 29 20:37:12 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 4Ry2G32Tnkz4vdd6 for ; Fri, 29 Sep 2023 20:37:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ry2G31xKpz3PY5; Fri, 29 Sep 2023 20:37:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696019835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4xBAYHovfnj9Pa3VhCtIocSl7C1Buplz27vVwou1Myo=; b=W0NE/LAXyhC3R9iBUqOuLEai62Gdoi7BhRDo45URZ7nZyb7ArJUevuo7vLWSP9qO4+bIs7 V5JQcOh7XrQSocmgqYaL2nhngEP4U3W9gCzTVF7M5ZbJeokuMaez9TcG+6Z5VGTZGLMBmd lwWq//uS9SKjCSVY/2F7nkS0Wtr38WYomBUOF8hIrcofnxlLMuDbejt9XNKlDHsXXqicTz aSxCl+oHvHfVfW4gTzf98Pq6wtevKn4Nn4ernQeF/LrzK5jwY3+AG8v9ncX6Cxajh0KtMa CLsYdtAGLlOzZAPYIUJMnqvjKKlrx1wHcFER3cmtmvGzL/m2sJMVMtv8o5Q9rw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696019835; a=rsa-sha256; cv=none; b=LB+TtsUHBtuYNhTGVvX+cEJIKFyO856aZ1LjHQ/YgSdw5pNHwL5hDyKZsnXLR2X5aDAeRD gYyxbIE35UqDmMxnOYezU8KbSyaxO7Sq5zPlqR6vO/s6HBN//H6OylDWaPTeOBkM98ZdNW mBUwYPPq1RuPkN8piQLQzvL+AwMFDXebV8pQNwiU9nk4gwQp1Bnf+aNr4IoyE8mywsVUhn 86SQnwQQDnRgobODeAIzppjfyW2BCIEqSmxosPaPrpOFy7N+cVstPj5hHrjXmda+uI3t8I PEvRNPaEqiGREYoA8i704bhv4/qORJZ4GzTJcflcgfWFeyyynOM9iPvEW6yTyg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696019835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4xBAYHovfnj9Pa3VhCtIocSl7C1Buplz27vVwou1Myo=; b=dOiNypRlQ9+H/c90G83tlPng+Gqxn6y8jemOm8p1oc35HVcjWwttQFJ34we31e2mPnviC+ jmWcKIcUi8JQG+7DBMI9E8VwxBpj7+4mnC5pZ5XcWu5rTAsVmHQnk0UG+vfdftKixndHre FNhnsA/Fgom8uWCkXR9qkQsLf6MXOzAXODfy+rwpTGFpFaSwQSeFTQpTQOsTtGx/uAb/DB huvmZsNfE7fOysordhus817VygsQ55iHOTJOgDtjmoPEx+gUtBqDrXD6Dq+wwZgU41Pabu KMoJZcKfhscGwAi6gd4cp43Iwsyeprm3zh8Sxo4gsveUq/56PBb294jlpV9Ujg== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Ry2G26LlKz1Dfg; Fri, 29 Sep 2023 20:37:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <85039cfe-3c59-173d-f2f2-f0ca8e0fa1c8@FreeBSD.org> Date: Fri, 29 Sep 2023 15:37:12 -0500 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 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: grep(1) bug - duplicate output lines Content-Language: en-US To: Jamie Landeg-Jones , freebsd-current@FreeBSD.org References: <202309280240.38S2esgN015958@donotpassgo.dyslexicfish.net> <8d0658e9-8984-a241-ad1d-e5aa1328d7fa@FreeBSD.org> <202309291629.38TGTU56092229@donotpassgo.dyslexicfish.net> <202309291825.38TIPNN2096338@donotpassgo.dyslexicfish.net> From: Kyle Evans In-Reply-To: <202309291825.38TIPNN2096338@donotpassgo.dyslexicfish.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 9/29/23 13:25, Jamie Landeg-Jones wrote: > Jamie Landeg-Jones 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