Paul Eggert <eggert@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Paul Eggert <eggert@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 18 Oct 2021 03:59:46 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 17 23:59:46 2021 Received: from localhost ([127.0.0.1]:45562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcJoP-0008Tx-CI for submit <at> debbugs.gnu.org; Sun, 17 Oct 2021 23:59:46 -0400 Received: from lists.gnu.org ([209.51.188.17]:53670) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcEcB-0000FW-PR for submit <at> debbugs.gnu.org; Sun, 17 Oct 2021 18:26:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcEcB-0007zU-HD for bug-grep@HIDDEN; Sun, 17 Oct 2021 18:26:47 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:46817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcEc9-0006zs-UF for bug-grep@HIDDEN; Sun, 17 Oct 2021 18:26:47 -0400 Received: by mail-lf1-x129.google.com with SMTP id i24so61974297lfj.13 for <bug-grep@HIDDEN>; Sun, 17 Oct 2021 15:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to:cc:from :subject; bh=E1bcdLE1ntXiCxw81mIZnkj0aDVwIMA6gjMvdrm5A/0=; b=fXHyrUl0hSur6IrjtNeOhT7gkHW0Awi6NO2oSdlrtLCHphg+FzgVveWfWVdG6rHCVA JD4W7aKNUMW4dN23HmHJk55F51h38mTcxH63JWydvxL1WeEsKY1da5nKFyl4PIBZLBcH 0yvWDdPIVhwJqdXXZAkQp0RWtbOUAJD5oDKONxoubK7n8pu/eHYRM1hKbpUEjIspAHkR XnpJ+Jc9sMYhxeDgBXbuPc7SjwBdyRxG0t36wvxVlitskt5OK+gWMFv9UfoXA2MN9aus pMbqwQXLLbOa3Ka2JpsFSXvXI7ihgVZaoY2Fw+BxrMUfoXU1d/w9wj1nUbnLS4ghGiLF pKNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:from:subject; bh=E1bcdLE1ntXiCxw81mIZnkj0aDVwIMA6gjMvdrm5A/0=; b=nGmAHiimF1vC339MmfTI8yTKDccG50YhZja0eCLsANxesDe4Or+ejEuJ1YyGkZJx9d crBS+McXDRbgkt1jsrWCIGl9rRVPVcmzkLFV/qpnRShxN9xBpZtyzxc9uqYlK1FXcjxv bmw3R/kRe2LpUVTFcTWLd27Ty20Fh4jxaXMzwyCu6XL/cZ4wU6ohpAxm0v4Eet+IvjO2 dQBuBA4YGyUn1trOI4h8nICb11zXN7qhhJflud5UQagjEBoNS/6lnObefXeTxtD++2H5 +gvR9BRZP0uepGlJuhnUsYhXFpK1G+am2tN7yKgeo8mBKAiz/h5gXs1GZrRtHICeA9/r 2BLw== X-Gm-Message-State: AOAM533OrO5zLcXA2jQ5LTs/ZBtfPaiTpb/bsL4Zm6FN1ppqfuFphRkz nTvUb7Hd7q2e6Jq5/BOPVghcZxCsglvxVg== X-Google-Smtp-Source: ABdhPJzf18Jk0boOdY4grWMY4m+HifEAiT7QUKX6zGJ7zZC3zgtZKWxKmZde/c1zjP508Z+yljpZBA== X-Received: by 2002:a05:6512:6d3:: with SMTP id u19mr24331298lff.106.1634509603554; Sun, 17 Oct 2021 15:26:43 -0700 (PDT) Received: from [10.8.2.3] ([45.134.212.145]) by smtp.gmail.com with ESMTPSA id s3sm1240833lfp.264.2021.10.17.15.26.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Oct 2021 15:26:43 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------77RGBoYuUJoxVSEgbyGMIsAF" Message-ID: <c4eab445-486e-7f5c-dc4f-91ede51156ce@HIDDEN> Date: Mon, 18 Oct 2021 00:26:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Content-Language: en-US To: bug-grep@HIDDEN From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Subject: grep --ignore-case --color does not always color the matches Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=tomasz.dziendzielski@HIDDEN; helo=mail-lf1-x129.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 Cc: 39678 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------77RGBoYuUJoxVSEgbyGMIsAF Content-Type: multipart/alternative; boundary="------------bMg9yKCcp6UtuX6QbFlW0Aew" --------------bMg9yKCcp6UtuX6QbFlW0Aew Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello, I did some investigation and it seems the problem with '\a' is not that the output is not colored but that it's printed at all while it should not be. It's being printed even when re_search in EGexecute doesn't return a match. As a result the for loop in print_line_middle is not being run - this means the 'a' output that you see is not from the matched string but from the rest of the line. To fix this I suggest to return NULL from print_line_middle if 'b' variable equals NULL - which means the loop was not executed. I'm sending the patch with the fix in the attachment. Best regards, Tomasz Dziendzielski --------------bMg9yKCcp6UtuX6QbFlW0Aew Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body> <div dir="auto"> <div class="gmail_quote" dir="auto"> <div dir="ltr" class="gmail_attr">Hello,</div> <div dir="ltr" class="gmail_attr">I did some investigation and it seems the problem with '\a' is not that the output is not colored but that it's printed at all while it should not be. It's being printed even when re_search in EGexecute doesn't return a match. As a result the for loop in print_line_middle is not being run - this means the 'a' output that you see is not from the matched string but from the rest of the line. To fix this I suggest to return NULL from print_line_middle if 'b' variable equals NULL - which means the loop was not executed.</div> <div dir="ltr" class="gmail_attr"><br> </div> <div dir="ltr" class="gmail_attr">I'm sending the patch with the fix in the attachment.</div> <div dir="ltr" class="gmail_attr"><br> </div> <div dir="ltr" class="gmail_attr">Best regards,</div> <div dir="ltr" class="gmail_attr">Tomasz Dziendzielski</div> </div> </div> </body> </html> --------------bMg9yKCcp6UtuX6QbFlW0Aew-- --------------77RGBoYuUJoxVSEgbyGMIsAF Content-Type: text/x-patch; charset=UTF-8; name="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Disposition: attachment; filename*0="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Transfer-Encoding: base64 RnJvbSAwNzgwNTI1OWI5YmYzZTE2Nzg0N2ExY2Y1MzA4YjZjNTQwMThiNzA5IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBUb21hc3ogRHppZW5kemllbHNraSA8dG9tYXN6LmR6 aWVuZHppZWxza2lAZ21haWwuY29tPgpEYXRlOiBTdW4sIDE3IE9jdCAyMDIxIDIxOjQ3OjI4 ICswMjAwClN1YmplY3Q6IFtQQVRDSF0gZ3JlcDogRG9uJ3QgcHJpbnQgbGluZSBpZiBtYXRj aGVyIHJldHVybmVkIG5vdGhpbmcKCkl0IGNhbiBoYXBwZW4gdGhhdCByZV9zZWFyY2ggaW4g RUdleGVjdXRlIGZhaWxzIGFuZCByZXR1cm5zIG5vdGhpbmcgc28KZm9yIGxvb3AgaW4gcHJp bnRfbGluZV9taWRkbGUgcnVucyB6ZXJvIHRpbWVzIGJ1dCBzdGlsbCBzdGlsbCByZXR1cm5z CnRyYXNoIHVuZGVyIGBjdXJgIHZhcmlhYmxlLCBzbyBncmVwIHRoaW5rcyBpdCBtYXRjaGVk IHNvbWV0aGluZyBhbmQgdGhlbgpyZXR1cm5zIHdob2xlIGxpbmUuCgpGaXhlcyBidWcgMzk2 NzguIElzc3VlIHdhcyB0aGF0IHNlY29uZCBvZiBiZWxvdyBjb21tYW5kcyBkaWQgbm90IGNv bG9yCnRoZSAiYSIgY2hhcmFjdGVyOgp8IGVjaG8gYSB8IGdyZXAgLWkgLS1jb2xvciAnXEEn CnwgZWNobyBhIHwgZ3Jl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ICAgY3VyID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisg ICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --------------77RGBoYuUJoxVSEgbyGMIsAF--
Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN>
:bug-grep@HIDDEN
.
Full text available.bug-grep@HIDDEN
:bug#51257
; Package grep
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.