X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Benno Schulenberg <bensberg@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Wed, 19 Feb 2020 15:28:01 +0000 Resent-Message-ID: <handler.39678.B.158212605015964 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 39678 <at> debbugs.gnu.org Cc: bpaddis@HIDDEN X-Debbugs-Original-To: bug-grep@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.158212605015964 (code B ref -1); Wed, 19 Feb 2020 15:28:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Feb 2020 15:27:30 +0000 Received: from localhost ([127.0.0.1]:43244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1j4RG5-00049Q-JQ for submit <at> debbugs.gnu.org; Wed, 19 Feb 2020 10:27:30 -0500 Received: from lists.gnu.org ([209.51.188.17]:55822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <bensberg@HIDDEN>) id 1j4MeD-0007Xw-GT for submit <at> debbugs.gnu.org; Wed, 19 Feb 2020 05:32:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57012) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <bensberg@HIDDEN>) id 1j4MeC-0003pz-13 for bug-grep@HIDDEN; Wed, 19 Feb 2020 05:32:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: *** X-Spam-Status: No, score=3.3 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE, RECEIVED_FROM_WINDOWS_HOST,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <bensberg@HIDDEN>) id 1j4Me9-0008Jq-Lj for bug-grep@HIDDEN; Wed, 19 Feb 2020 05:32:03 -0500 Received: from cpsmtpb-ews06.kpnxchange.com ([213.75.39.9]:53754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <bensberg@HIDDEN>) id 1j4Me9-0008E3-6P for bug-grep@HIDDEN; Wed, 19 Feb 2020 05:32:01 -0500 Received: from cpsps-ews29.kpnxchange.com ([10.94.84.195]) by cpsmtpb-ews06.kpnxchange.com with Microsoft SMTPSVC(8.5.9600.16384); Wed, 19 Feb 2020 11:18:57 +0100 X-Brand: /q/rzKX13g== X-KPN-SpamVerdict: e1=0;e2=0;e3=0;e4=(e1=10;e3=10;e2=11;e4=10);EVW:Whi te;BM:NotScanned;FinalVerdict:Clean X-CMAE-Analysis: v=2.3 cv=OKhZIhSB c=1 sm=1 tr=0 cx=a_idp_e a=ShNidqeCEQB33TAKUUzslw==:117 a=X0PnwcQ2/mKcBfosUKIoXQ==:17 a=UhJ12kwm0HYA:10 a=l697ptgUJYAA:10 a=13zjGPudsaEWiJwPRgMA:9 a=CCpqsmhAAAAA:8 a=mDV3o1hIAAAA:8 a=IdY-70gDFS1MlXiAy7AA:9 a=QEXdDO2ut3YA:10 a=8adgskg2ibn4Zlw2IdEA:9 a=FfaGCDsud1wA:10 a=ul9cdbp4aOFLsgKbc677:22 a=_FVE-zBwftR9WsbkzFJk:22 X-CM-AcctID: kpn@HIDDEN Received: from smtp.kpnmail.nl ([195.121.84.11]) by cpsps-ews29.kpnxchange.com over TLS secured channel with Microsoft SMTPSVC(8.5.9600.16384); Wed, 19 Feb 2020 11:18:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telfort.nl; s=telfort01; h=content-type:mime-version:date:message-id:subject:from:to; bh=0I2J7oLvG+3RwRomWXhENFULNZH6gGsd5I2cTk1h03Y=; b=aJ/HAx4+oOYzXkD/jQ0H9SGeklz58caif7cDxhcuQy1Kw4VNDzPmiMIJpPT7CEoOjr5UVjT9HYhbU IL5tHaiT8yOV84a1X+zXFxjX37VDU2L10ZX4D/QesH/k5DdcH0f/Ymt8+Rbdmuago+Fj/q3ihw2amn T+rzAnTmVLXYdQIA= X-KPN-VerifiedSender: Yes X-CMASSUN: 33|X+/Of6sHjalIcInXJ1d5StBd6jdBvlsajUHbNuLoxjgBHe1BZKknsNMEuVPUiyN WpCABitDQK303QNxFZnaNjg== X-Originating-IP: 77.173.60.12 Received: from [192.168.2.25] (unknown [77.173.60.12]) by smtp.kpnmail.nl (Halon) with ESMTPSA id 2bb28a55-5301-11ea-8c67-00505699b758; Wed, 19 Feb 2020 11:18:57 +0100 (CET) From: Benno Schulenberg <bensberg@HIDDEN> Message-ID: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> Date: Wed, 19 Feb 2020 11:18:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3oIVALlaqufDu2csJxP6FWWerhBXIjPxh" X-OriginalArrivalTime: 19 Feb 2020 10:18:57.0121 (UTC) FILETIME=[FEB5B510:01D5E70D] X-RcptDomain: gnu.org X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 213.75.39.9 X-Spam-Score: -0.7 (/) X-Mailman-Approved-At: Wed, 19 Feb 2020 10:27:28 -0500 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: -1.7 (-) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3oIVALlaqufDu2csJxP6FWWerhBXIjPxh Content-Type: multipart/mixed; boundary="xdgtRhBEyQWKxE60X0sV75swdSD209Bf5" --xdgtRhBEyQWKxE60X0sV75swdSD209Bf5 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable echo a | grep -i --color '\a' echo a | grep -i --color '\A' Of the above two commands, only the second colorizes the printed "a". (An old GNU grep on NetBSD (grep 2.5.1a nb1) does the opposite of a modern grep: it will show color for \a, but none for \A.) Bug was found in GNU grep 3.1 while checking whether it understands \d as a shorthand for [0-9]. Still present in 3.4. The locale does not appear to matter. In a report against glibc [1] that seems to be related, a comment says that "Unknown backslash escapes invoke undefined behaviour." But where in the documentation does it say so? When searching for a regular expression in GNU nano (^W M-R), nano says it cannot find any \a. But for \A, it will find all "a"s and "A"s. Nano's default search is case insensitive. See [2] for the original report by Ben Addis. I suppose this is the same or a related bug in the regex module of gnulib, which nano uses. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=3D22425 [2] https://savannah.gnu.org/bugs/?57852 Benno --xdgtRhBEyQWKxE60X0sV75swdSD209Bf5-- --3oIVALlaqufDu2csJxP6FWWerhBXIjPxh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEv9AJBh5TUFKtDfIVDSjU0qCs6IQFAl5NC3MACgkQDSjU0qCs 6ITA1g/7BNjP9Up24alRPYvUlDgNfTg51ysEb6i6dRiAsyTziVXKB854FjmMGPCL TOR/PKNIQNM7OotcNI4Pz1vEhWAN+XPu+ipFj/JNLw+s88DFp14xVefM93QTkYx5 QmqA0Rzd+Q01oQ0ZA/eHegx+GKwzKFq+9XFlG/9UhRt1cs8jEsqcLZ7MWvS3aTME XVYDf0IkOhe6rf6e8va3oS8DDPWiPu0IcLNp5zfuvTeENEeRDMSlrcL9KQA7CdO1 5zQswXYzaMC5xM8TeL4ar5jV1CDVAzeI3BUVpPGjv1tsANdV+ivZBD+niZ3S6WED CaVZ2bvTXF0eWbZ2Do8GRnYOvgGa7SveigjJMYOLCITgotwEhXem2z0aewc1ouix rZqLTmr6j0xDM1ygpN3G1yEUkp+jKDUQcskFy4L4NtSoqISJZwLdUQqDnhcBtQ6G XurJLzfZpaIa/5AMY1kMdNqWjPBiNNKNM5S5olyY3mm7nrThC0ok8fSRHAJSpqcf pXU2OvKRQA1L/ppSW2kF263E8z/xMc60m4wKayn92JHEL5ZEZ7IXdzge0n3mmxzd VR1YGKSORUE9HgzCb5CAOt79+FbjOxrlzIB7u3QFFBXNSawVCgCGY0Fbruix1yP/ aDOT1Qs1dx0jH1oF7XCOFNcpJPu9TNZ4zzUB7SGz+LWi71n+HNM= =NBti -----END PGP SIGNATURE----- --3oIVALlaqufDu2csJxP6FWWerhBXIjPxh--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Benno Schulenberg <bensberg@HIDDEN> Subject: bug#39678: Acknowledgement ('grep --ignore-case --color' does not always color the matches) Message-ID: <handler.39678.B.158212605015964.ack <at> debbugs.gnu.org> References: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> X-Gnu-PR-Message: ack 39678 X-Gnu-PR-Package: grep Reply-To: 39678 <at> debbugs.gnu.org Date: Wed, 19 Feb 2020 15:28:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-grep@HIDDEN If you wish to submit further information on this problem, please send it to 39678 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 39678: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D39678 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches References: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> In-Reply-To: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 04:00:02 +0000 Resent-Message-ID: <handler.39678.B.163452955332536 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 39678 <at> debbugs.gnu.org, bensberg@HIDDEN X-Debbugs-Original-To: bug-grep@HIDDEN, bensberg@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.163452955332536 (code B ref -1); Mon, 18 Oct 2021 04:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Oct 2021 03:59:13 +0000 Received: from localhost ([127.0.0.1]:45548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcJnp-0008SW-W2 for submit <at> debbugs.gnu.org; Sun, 17 Oct 2021 23:59:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:38982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcCva-0005hP-Na for submit <at> debbugs.gnu.org; Sun, 17 Oct 2021 16:38:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40434) 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 1mcCva-0001Q9-G7 for bug-grep@HIDDEN; Sun, 17 Oct 2021 16:38:42 -0400 Received: from mail-ua1-x931.google.com ([2607:f8b0:4864:20::931]:34435) 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 1mcCvY-0008NW-Aa for bug-grep@HIDDEN; Sun, 17 Oct 2021 16:38:41 -0400 Received: by mail-ua1-x931.google.com with SMTP id h4so689184uaw.1 for <bug-grep@HIDDEN>; Sun, 17 Oct 2021 13:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=Uhmr0lL3qmKRVR0fYvPcQxXnQMmH2/wIdqDj0dnjD7k=; b=IG23gCLRg2U87BN6LsnTqemAA4n0mlPKDJfBlC6GlvY+n+4LtXhePQi4DxxN4dmnWE N2O9Ik8U03sb+SwsrOWJZLUvCVAgxdHZ0qQLJkcCpzMa4diknNLFrwBDHYLyn+fO8MjL pomRoLm+B8X1h8ONiQ/LFwSwXSfYYNIj3YM/apRnZ6EsxHFV0JPQeW1G1l+SLxKUgNF/ 2GMVk9u9nivyyPfrVvKB2nfG6JGNLlfg0j9pN5YIKnOWUnly+y+Zi8p5NOEZ9RqQKAIn MVPTWSBsfizeQWhQWPauzThOvLmgP1FguJfdOWIAM8DVq/fr6Pakca0/Qu8Z3FYPmff2 wmcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Uhmr0lL3qmKRVR0fYvPcQxXnQMmH2/wIdqDj0dnjD7k=; b=yg2f9WD5kyU54MY6Z4saEUK0GNRk60BDOqpIFIS1T5Vl3u38ENV0v4rXQtQP/rkkQ8 26HMSa9zw/RDmrhgMzx631a9aWAGkIRKNOHKpelk9mfTyy2uawLGagosqSsDq8I7ttg/ nQp2ksV7weGiATtZ0mUOsWs7yXfmLBR6iDa9Uf62UreEmUKwkeORRDnyhbXAnH38DBrE lDuXqI3fBePLwAVFZojtBXdcCQ1eOcOpEAMqeWv9+qd8460lkbS+ZgejeEPN9+ifGMDc gBLfXOdzfKrGYUtaUOzCkQP61keNxbPe8b3DarB17gLbfbge8Isgx9Ycw5MDmlcr19YG YXdg== X-Gm-Message-State: AOAM531FGBuU8nb1dP4gj9eaMEkniwUHfvfVIc3hTSkfOTkWehYTmq/p 0E5jGAFrGmlCkhC3nBdYn82hpNYW/uivyyB/HMigqzZg X-Google-Smtp-Source: ABdhPJxWg9AeCgrMzI6Twqv0apHX4CZlm96GmFOBTyLvTN1/RrCxXfpgULncziMzHZ+8/BMiaVX3RZuloumivjuuUy0= X-Received: by 2002:ab0:35cc:: with SMTP id x12mr22725756uat.45.1634503117988; Sun, 17 Oct 2021 13:38:37 -0700 (PDT) MIME-Version: 1.0 From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Sun, 17 Oct 2021 22:38:27 +0200 Message-ID: <CAJkqNs1Do07M=gw+aCywiwMA8Pk7DAApo4BkfauvB+jNQc4yoA@HIDDEN> Content-Type: multipart/mixed; boundary="000000000000bb81d205ce926900" Received-SPF: pass client-ip=2607:f8b0:4864:20::931; envelope-from=tomasz.dziendzielski@HIDDEN; helo=mail-ua1-x931.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_40=-0.001, 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-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 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: -3.3 (---) --000000000000bb81d205ce926900 Content-Type: multipart/alternative; boundary="000000000000bb81d005ce9269fe" --000000000000bb81d005ce9269fe Content-Type: text/plain; charset="UTF-8" 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 one can 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 --000000000000bb81d005ce9269fe Content-Type: text/html; charset="UTF-8" <div dir="ltr"><div>Hello,<br></div><div>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 one can 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.<br></div><div><br></div><div>I'm sending the patch with the fix in the attachment.</div><div><br></div><div>Best regards,</div><div>Tomasz Dziendzielski</div></div> --000000000000bb81d005ce9269fe-- --000000000000bb81d205ce926900 Content-Type: application/x-patch; name="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Disposition: attachment; filename="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Transfer-Encoding: base64 Content-ID: <f_kuvokisl0> X-Attachment-Id: f_kuvokisl0 RnJvbSAwNzgwNTI1OWI5YmYzZTE2Nzg0N2ExY2Y1MzA4YjZjNTQwMThiNzA5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUb21hc3ogRHppZW5kemllbHNraSA8dG9tYXN6LmR6aWVuZHpp ZWxza2lAZ21haWwuY29tPgpEYXRlOiBTdW4sIDE3IE9jdCAyMDIxIDIxOjQ3OjI4ICswMjAwClN1 YmplY3Q6IFtQQVRDSF0gZ3JlcDogRG9uJ3QgcHJpbnQgbGluZSBpZiBtYXRjaGVyIHJldHVybmVk IG5vdGhpbmcKCkl0IGNhbiBoYXBwZW4gdGhhdCByZV9zZWFyY2ggaW4gRUdleGVjdXRlIGZhaWxz IGFuZCByZXR1cm5zIG5vdGhpbmcgc28KZm9yIGxvb3AgaW4gcHJpbnRfbGluZV9taWRkbGUgcnVu cyB6ZXJvIHRpbWVzIGJ1dCBzdGlsbCBzdGlsbCByZXR1cm5zCnRyYXNoIHVuZGVyIGBjdXJgIHZh cmlhYmxlLCBzbyBncmVwIHRoaW5rcyBpdCBtYXRjaGVkIHNvbWV0aGluZyBhbmQgdGhlbgpyZXR1 cm5zIHdob2xlIGxpbmUuCgpGaXhlcyBidWcgMzk2NzguIElzc3VlIHdhcyB0aGF0IHNlY29uZCBv ZiBiZWxvdyBjb21tYW5kcyBkaWQgbm90IGNvbG9yCnRoZSAiYSIgY2hhcmFjdGVyOgp8IGVjaG8g YSB8IGdyZXAgLWkgLS1jb2xvciAnXEEnCnwgZWNobyBhIHwgZ3JlcCAtaSAtLWNvbG9yICdcYScK YnV0IGluIGZhY3QgaXQgc2hvdWxkbid0IGV2ZW4gcHJpbnQgaXQgaW4gdGhlIGZpcnN0IHBsYWNl LCBzaW5jZSBnbnVsaWIKcmVnZXggZG9lc24ndCBtYXRjaCBpdC4KCiogc3JjL2dyZXAuYzogcHJp bnRfbGluZV9taWRkbGU6IFJldHVybiBOVUxMIGlmIG1hdGNoIG5vdCBmb3VuZCBhbmQgZm9yCmxv b3Agbm90IGV4ZWN1dGVkCgpTaWduZWQtb2ZmLWJ5OiBUb21hc3ogRHppZW5kemllbHNraSA8dG9t YXN6LmR6aWVuZHppZWxza2lAZ21haWwuY29tPgotLS0KIHNyYy9ncmVwLmMgfCA0ICsrKy0KIDEg ZmlsZSBjaGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQg YS9zcmMvZ3JlcC5jIGIvc3JjL2dyZXAuYwppbmRleCBhNTUxOTRjZjFhYTkwNzJlY2MzN2ExMzU3 NGJjNTg4MTY3ZWU1ZDk0Li5iMzcyZTM0MTVjY2JmNmY4OTYwMzlhNmQ3MmJkNmMzNDk4ZDhjMjY5 IDEwMDY0NAotLS0gYS9zcmMvZ3JlcC5jCisrKyBiL3NyYy9ncmVwLmMKQEAgLTEyMTMsNyArMTIx Myw3IEBAIHByaW50X2xpbmVfbWlkZGxlIChjaGFyICpiZWcsIGNoYXIgKmxpbSwKICAgcHRyZGlm Zl90IG1hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQgPSBOVUxMOwotICBj aGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9IGJlZzsKICAgICAgICAo Y3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9saW5lX21pZGRsZSAoY2hhciAq YmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBlbHNlIGlmIChtaWQpCiAgICAgY3Vy ID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisgICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0 dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --000000000000bb81d205ce926900--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: #39678: grep --ignore-case --color does not always color the matches References: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> In-Reply-To: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 04:00:05 +0000 Resent-Message-ID: <handler.39678.B39678.163452956932569 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: bensberg@HIDDEN, 39678 <at> debbugs.gnu.org X-Debbugs-Original-To: bensberg@HIDDEN, bug-grep@HIDDEN X-Debbugs-Original-Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163452956932569 (code B ref 39678); Mon, 18 Oct 2021 04:00:05 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 03:59:29 +0000 Received: from localhost ([127.0.0.1]:45552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcJnu-0008Sr-CF for submit <at> debbugs.gnu.org; Sun, 17 Oct 2021 23:59:29 -0400 Received: from mail-ua1-f46.google.com ([209.85.222.46]:46800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcDqk-0007It-Dj for 39678 <at> debbugs.gnu.org; Sun, 17 Oct 2021 17:37:48 -0400 Received: by mail-ua1-f46.google.com with SMTP id u5so3359131uao.13 for <39678 <at> debbugs.gnu.org>; Sun, 17 Oct 2021 14:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=zSjCPIx4dbKVOfXVussoCC6+Ci2sA5Gtrmo2/WUtamU=; b=GM3LnILOP19equKf/rMzvNtHIBZJHWcVN4SM4z1aqwVl//3GT7PK1TTD3T00y+OK77 B+RjVZaptGnt4UdmiZO88aEeV9N8mtC5O5fJVUgb0QVqStNiNdjQzH9vROySqiiqEP/6 WwHLIosFP31sV3bk96sE8Qln4chhdoaNoNDlvWHHTRSV5tVuFqHXxQZ5KFskUEDQFNS9 czC594FDsxlKyYTPg8B4TGfUwlaxmLLRG8y3jia3Bcn1avsyskbRFfs91VlnjLKHcMn7 Z7nQXGPYipeoMxYashs2vgcwvVSf9Vq6nvByekZOD6sxJh2B3NjEpLDYYjNRAFFrDbtn 5UTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=zSjCPIx4dbKVOfXVussoCC6+Ci2sA5Gtrmo2/WUtamU=; b=gE/Tjrk7sNaumPPDsh576aESP9VK5iqdnAE44TD+IdO/jL8y3aSo1o3fKCgoNt1l9Q 5Kg7/R8dM8VLyUg+PAVswVKCm7EWuwVdoB7UP+EIouq4WD9d5cYNelS2VKIsyds0k57R aIDhY+ZEDyNGpm34GZhK6tlTGu7vQoGWtztB6sUvWztXO3q+2WQxnk6NMw7OwVRZ6FTE 0OO151lk9Vrs7WWpbsIb54oP26k4+s5nsFNJtjHjQJTISHkBc31P9WmSAQezMV0fgYCe wrjlwK3x5xQeUFqeotwyLhn474qvmqU29Vbwk0LHaoq8Xr1Xmk+Dkn54oQrvio/wEAQl TgQA== X-Gm-Message-State: AOAM5315w1xvxFBUnHLSxnP21yA4AEk5IokVM9O5lNs8CDhxNQCBns2O vlCpwsZUdGydtjZ+4chRzQvLgdLojAUGsbuuY7qdMDH3UM0= X-Google-Smtp-Source: ABdhPJzwCwJ7AQr8fRNdpolI/40otYnRqIpsCUjKhzRSRiRgBfWb3NzKgksupnuSYHk/4qNh4tJ3bFfuiiH9GatHILY= X-Received: by 2002:ab0:35cc:: with SMTP id x12mr22800878uat.45.1634506660847; Sun, 17 Oct 2021 14:37:40 -0700 (PDT) MIME-Version: 1.0 From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Sun, 17 Oct 2021 23:37:30 +0200 Message-ID: <CAJkqNs3JauqDc7cy6YTJR2XunmzZzyG5ogi4UJEarVCGcXWsng@HIDDEN> Content-Type: multipart/mixed; boundary="000000000000e79a3705ce933c51" X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 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: -1.0 (-) --000000000000e79a3705ce933c51 Content-Type: multipart/alternative; boundary="000000000000e79a2705ce933c4f" --000000000000e79a2705ce933c4f Content-Type: text/plain; charset="UTF-8" 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 --000000000000e79a2705ce933c4f Content-Type: text/html; charset="UTF-8" <div dir="ltr"><div>Hello,<br></div><div>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.<br></div><div><br></div><div>I'm sending the patch with the fix in the attachment.</div><div><br></div><div>Best regards,</div><div>Tomasz Dziendzielski</div></div> --000000000000e79a2705ce933c4f-- --000000000000e79a3705ce933c51 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Disposition: attachment; filename="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Transfer-Encoding: base64 Content-ID: <f_kuvr09bg0> X-Attachment-Id: f_kuvr09bg0 RnJvbSAwNzgwNTI1OWI5YmYzZTE2Nzg0N2ExY2Y1MzA4YjZjNTQwMThiNzA5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUb21hc3ogRHppZW5kemllbHNraSA8dG9tYXN6LmR6aWVuZHpp ZWxza2lAZ21haWwuY29tPgpEYXRlOiBTdW4sIDE3IE9jdCAyMDIxIDIxOjQ3OjI4ICswMjAwClN1 YmplY3Q6IFtQQVRDSF0gZ3JlcDogRG9uJ3QgcHJpbnQgbGluZSBpZiBtYXRjaGVyIHJldHVybmVk IG5vdGhpbmcKCkl0IGNhbiBoYXBwZW4gdGhhdCByZV9zZWFyY2ggaW4gRUdleGVjdXRlIGZhaWxz IGFuZCByZXR1cm5zIG5vdGhpbmcgc28KZm9yIGxvb3AgaW4gcHJpbnRfbGluZV9taWRkbGUgcnVu cyB6ZXJvIHRpbWVzIGJ1dCBzdGlsbCBzdGlsbCByZXR1cm5zCnRyYXNoIHVuZGVyIGBjdXJgIHZh cmlhYmxlLCBzbyBncmVwIHRoaW5rcyBpdCBtYXRjaGVkIHNvbWV0aGluZyBhbmQgdGhlbgpyZXR1 cm5zIHdob2xlIGxpbmUuCgpGaXhlcyBidWcgMzk2NzguIElzc3VlIHdhcyB0aGF0IHNlY29uZCBv ZiBiZWxvdyBjb21tYW5kcyBkaWQgbm90IGNvbG9yCnRoZSAiYSIgY2hhcmFjdGVyOgp8IGVjaG8g YSB8IGdyZXAgLWkgLS1jb2xvciAnXEEnCnwgZWNobyBhIHwgZ3JlcCAtaSAtLWNvbG9yICdcYScK YnV0IGluIGZhY3QgaXQgc2hvdWxkbid0IGV2ZW4gcHJpbnQgaXQgaW4gdGhlIGZpcnN0IHBsYWNl LCBzaW5jZSBnbnVsaWIKcmVnZXggZG9lc24ndCBtYXRjaCBpdC4KCiogc3JjL2dyZXAuYzogcHJp bnRfbGluZV9taWRkbGU6IFJldHVybiBOVUxMIGlmIG1hdGNoIG5vdCBmb3VuZCBhbmQgZm9yCmxv b3Agbm90IGV4ZWN1dGVkCgpTaWduZWQtb2ZmLWJ5OiBUb21hc3ogRHppZW5kemllbHNraSA8dG9t YXN6LmR6aWVuZHppZWxza2lAZ21haWwuY29tPgotLS0KIHNyYy9ncmVwLmMgfCA0ICsrKy0KIDEg ZmlsZSBjaGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQg YS9zcmMvZ3JlcC5jIGIvc3JjL2dyZXAuYwppbmRleCBhNTUxOTRjZjFhYTkwNzJlY2MzN2ExMzU3 NGJjNTg4MTY3ZWU1ZDk0Li5iMzcyZTM0MTVjY2JmNmY4OTYwMzlhNmQ3MmJkNmMzNDk4ZDhjMjY5 IDEwMDY0NAotLS0gYS9zcmMvZ3JlcC5jCisrKyBiL3NyYy9ncmVwLmMKQEAgLTEyMTMsNyArMTIx Myw3IEBAIHByaW50X2xpbmVfbWlkZGxlIChjaGFyICpiZWcsIGNoYXIgKmxpbSwKICAgcHRyZGlm Zl90IG1hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQgPSBOVUxMOwotICBj aGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9IGJlZzsKICAgICAgICAo Y3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9saW5lX21pZGRsZSAoY2hhciAq YmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBlbHNlIGlmIChtaWQpCiAgICAgY3Vy ID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisgICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0 dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --000000000000e79a3705ce933c51--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: grep --ignore-case --color does not always color the matches References: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> In-Reply-To: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 04:00:06 +0000 Resent-Message-ID: <handler.39678.B39678.163452958232596 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 39678 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-grep@HIDDEN X-Debbugs-Original-Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163452958232596 (code B ref 39678); Mon, 18 Oct 2021 04:00:06 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 03:59:42 +0000 Received: from localhost ([127.0.0.1]:45556 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcJoI-0008TW-2s for submit <at> debbugs.gnu.org; Sun, 17 Oct 2021 23:59:42 -0400 Received: from mail-ua1-f44.google.com ([209.85.222.44]:36490) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcEF2-00080H-QB for 39678 <at> debbugs.gnu.org; Sun, 17 Oct 2021 18:02:53 -0400 Received: by mail-ua1-f44.google.com with SMTP id e10so2314976uab.3 for <39678 <at> debbugs.gnu.org>; Sun, 17 Oct 2021 15:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=6UDvdp5bpFIf78JAvStQfQJma/jdf8AZ/asrwDWi0vc=; b=NHoycZCHc66JY9wox7qMfcDxIYau392YnX98PQwUyjbRo8Olr3Nr6DWFnYbggk751o 8pIYgwiXwYnwdHdlXDbw1FhIWVhQ8j6E4oJz7kvIbMw8K9+Bhxcxm7WRdVrpUMgSS+Ul QyX1fECbGVp7nX+8mX7tOXmFVppvzbfqnRsxkVTpK7wEpXQ7zXfjVQEd6CLszdlMUssY VRTMzx3XahGVlWGrQ2x+9MfLex/hvM8ykO1whpq8BjrE18xqRAJUL5D+goQzJazKuCS+ UBClrAjCnrkB8nu4cDtYYakDuNK2tGuSpZ3chauE7F4M5bizVaKW47dR/QgrUFocge8g g6Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=6UDvdp5bpFIf78JAvStQfQJma/jdf8AZ/asrwDWi0vc=; b=EyJFfzB3CToDtqTiyOUdJLEv/bM0A1d0/vj7uRe1G0SdLY7HzlgKAKhp9qviSmBqO0 jj/FJo0N0C0K63kiHm6MdflBCT4BYN2z4V6JGQ7lewUzuOY6rLOPgJT+LHjSTGdYSWWN gHxzFVfoou8vgHVdIhjRbfEO+tGhBnfLtvDv/LOC+CBCYrvb9IDwveMO6hNULxsp8N/v 0XqfoM44fQxceUjZBU2AiL+GrNlGygKOqRjlWVhceQZH5pRn4G50ZxJrz4R38gaL+MY5 loLrdc1N6ycsDivEVvJFYY/7KU4RPPnI34mguNgUnewWlNeR1ywjShSdFjate6R3VVU+ FYHQ== X-Gm-Message-State: AOAM533SCWqDKG2IR4btB6TieJYa9WgtHQ7a1vVoCRIjLqqaPztlLpSW krHK78piek9+K4zByzx8jdGUX0IA3zDz0m+xhmQ= X-Google-Smtp-Source: ABdhPJwT0OW+SlfQzMYcDzJx723oF+Xu1xkYa0M35mwVmYCoFYCxbdOOMxwdpyZNzysvAuiKrixRPISuI+Lo/snpvZY= X-Received: by 2002:a67:d606:: with SMTP id n6mr24240710vsj.51.1634508167065; Sun, 17 Oct 2021 15:02:47 -0700 (PDT) MIME-Version: 1.0 From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Mon, 18 Oct 2021 00:02:36 +0200 Message-ID: <CAJkqNs1AV05yqKSbch7rL8YX+=bjbfeUMWOyLN7V87K2U-2oTA@HIDDEN> Content-Type: multipart/mixed; boundary="000000000000aecb8205ce93967e" X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 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: -1.0 (-) --000000000000aecb8205ce93967e Content-Type: multipart/alternative; boundary="000000000000aecb7f05ce93967c" --000000000000aecb7f05ce93967c Content-Type: text/plain; charset="UTF-8" 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 --000000000000aecb7f05ce93967c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div class=3D"gmail_quote" dir=3D"auto"><div dir=3D"ltr" = class=3D"gmail_attr">Hello,</div><div dir=3D"ltr" class=3D"gmail_attr">I di= d some investigation and it seems the problem with "\a" is not that the output is not colored but that it'= s printed=20 at all while it should not be. It's being printed even when re_search i= n EGexecute doesn't return a match. As a result the for loop in=20 print_line_middle is not being run - this means the "a" output th= at you=20 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=20 equals NULL - which means the loop was not executed.</div><div dir=3D"ltr" = class=3D"gmail_attr"><br></div><div dir=3D"ltr" class=3D"gmail_attr">I'= m sending the patch with the fix in the attachment.</div><div dir=3D"ltr" c= lass=3D"gmail_attr"><br></div><div dir=3D"ltr" class=3D"gmail_attr">Best re= gards,</div><div dir=3D"ltr" class=3D"gmail_attr">Tomasz Dziendzielski</div= ></div></div> --000000000000aecb7f05ce93967c-- --000000000000aecb8205ce93967e Content-Type: application/octet-stream; name="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Disposition: attachment; filename="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Transfer-Encoding: base64 Content-ID: <17c9046ad63139915c91> X-Attachment-Id: 17c9046ad63139915c91 RnJvbSAwNzgwNTI1OWI5YmYzZTE2Nzg0N2ExY2Y1MzA4YjZjNTQwMThiNzA5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUb21hc3ogRHppZW5kemllbHNraSA8dG9tYXN6LmR6aWVuZHpp ZWxza2lAZ21haWwuY29tPgpEYXRlOiBTdW4sIDE3IE9jdCAyMDIxIDIxOjQ3OjI4ICswMjAwClN1 YmplY3Q6IFtQQVRDSF0gZ3JlcDogRG9uJ3QgcHJpbnQgbGluZSBpZiBtYXRjaGVyIHJldHVybmVk IG5vdGhpbmcKCkl0IGNhbiBoYXBwZW4gdGhhdCByZV9zZWFyY2ggaW4gRUdleGVjdXRlIGZhaWxz IGFuZCByZXR1cm5zIG5vdGhpbmcgc28KZm9yIGxvb3AgaW4gcHJpbnRfbGluZV9taWRkbGUgcnVu cyB6ZXJvIHRpbWVzIGJ1dCBzdGlsbCBzdGlsbCByZXR1cm5zCnRyYXNoIHVuZGVyIGBjdXJgIHZh cmlhYmxlLCBzbyBncmVwIHRoaW5rcyBpdCBtYXRjaGVkIHNvbWV0aGluZyBhbmQgdGhlbgpyZXR1 cm5zIHdob2xlIGxpbmUuCgpGaXhlcyBidWcgMzk2NzguIElzc3VlIHdhcyB0aGF0IHNlY29uZCBv ZiBiZWxvdyBjb21tYW5kcyBkaWQgbm90IGNvbG9yCnRoZSAiYSIgY2hhcmFjdGVyOgp8IGVjaG8g YSB8IGdyZXAgLWkgLS1jb2xvciAnXEEnCnwgZWNobyBhIHwgZ3JlcCAtaSAtLWNvbG9yICdcYScK YnV0IGluIGZhY3QgaXQgc2hvdWxkbid0IGV2ZW4gcHJpbnQgaXQgaW4gdGhlIGZpcnN0IHBsYWNl LCBzaW5jZSBnbnVsaWIKcmVnZXggZG9lc24ndCBtYXRjaCBpdC4KCiogc3JjL2dyZXAuYzogcHJp bnRfbGluZV9taWRkbGU6IFJldHVybiBOVUxMIGlmIG1hdGNoIG5vdCBmb3VuZCBhbmQgZm9yCmxv b3Agbm90IGV4ZWN1dGVkCgpTaWduZWQtb2ZmLWJ5OiBUb21hc3ogRHppZW5kemllbHNraSA8dG9t YXN6LmR6aWVuZHppZWxza2lAZ21haWwuY29tPgotLS0KIHNyYy9ncmVwLmMgfCA0ICsrKy0KIDEg ZmlsZSBjaGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQg YS9zcmMvZ3JlcC5jIGIvc3JjL2dyZXAuYwppbmRleCBhNTUxOTRjZjFhYTkwNzJlY2MzN2ExMzU3 NGJjNTg4MTY3ZWU1ZDk0Li5iMzcyZTM0MTVjY2JmNmY4OTYwMzlhNmQ3MmJkNmMzNDk4ZDhjMjY5 IDEwMDY0NAotLS0gYS9zcmMvZ3JlcC5jCisrKyBiL3NyYy9ncmVwLmMKQEAgLTEyMTMsNyArMTIx Myw3IEBAIHByaW50X2xpbmVfbWlkZGxlIChjaGFyICpiZWcsIGNoYXIgKmxpbSwKICAgcHRyZGlm Zl90IG1hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQgPSBOVUxMOwotICBj aGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9IGJlZzsKICAgICAgICAo Y3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9saW5lX21pZGRsZSAoY2hhciAq YmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBlbHNlIGlmIChtaWQpCiAgICAgY3Vy ID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisgICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0 dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --000000000000aecb8205ce93967e--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 04:00:06 +0000 Resent-Message-ID: <handler.39678.B39678.163452958332604 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163452958332604 (code B ref 39678); Mon, 18 Oct 2021 04:00:06 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 03:59:43 +0000 Received: from localhost ([127.0.0.1]:45558 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcJoM-0008Th-NS for submit <at> debbugs.gnu.org; Sun, 17 Oct 2021 23:59:42 -0400 Received: from mail-ua1-f42.google.com ([209.85.222.42]:42802) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcER8-0008Lt-DY for 39678 <at> debbugs.gnu.org; Sun, 17 Oct 2021 18:15:24 -0400 Received: by mail-ua1-f42.google.com with SMTP id j8so367942uak.9 for <39678 <at> debbugs.gnu.org>; Sun, 17 Oct 2021 15:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=KWN/4wKgyDgDCyCdNFN0SNNKoW/IGtQ5/hdC8vMo6Pw=; b=EBoAt94vgIw3Np9NXfS2kjgrWWp63a6MUYz5GdFID0qkaBtm9KcYpJHtggBhJapUeV COIE/MYgf5x/eJzLC6Lfx2FZ0TgsbuhwqVXnhTr3/c/1bHnEYcrbflYjQIZuy4SWDxO4 zwO3bUfp8yeoWbiR0u7HDIRAZzGvAhOo8Ow5jC96KjLWs2esFu0D1lqVbXyNRSBxGxEK +BbVc3TlheiKm/De2JaF6Ne19yfVVRH/byX5dMsQ3/ZVvN48tELoSXTX2Sqc8EmjIo+0 gyA4CJE1/z33FTK4KO9Ce0Xpxr3LfEeJYp6gEIg5TxfVu8/SkGrgQcC8stmL5Sd95ZS4 nr5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=KWN/4wKgyDgDCyCdNFN0SNNKoW/IGtQ5/hdC8vMo6Pw=; b=FlYCCNrZ7UVC6vBQDguGNc8/lnVEYQSTtYv510MH63ArZsWbdGwakNylfmG0bPr9NV 9mR1tBQr1gfnl2PkGu0C5az4XsZsJ+LKG7O/x6IRO1knCmiDXSOjrHo0ZNjKxDmp59wx zdGCv8GR2AlVs7X0uVBargO6f/gx4mgJIvZmTCHUb7Qge0bChGFjkjTEqNd4TH+prK0k geCpeXXtFaHKrfE5lFf4/JbGT7a++YrQFNEuFIl1J19rEHEQ6v7gYS4eAp6recIomYUb C8V8KExjb3VQpTqKF5LPM8pcpRJvF46yoNLdG/02MwaHfUDSCRC4ZAqIpfhDNm9WHdOy UMpQ== X-Gm-Message-State: AOAM530TAoD2wnuxMNihAGePzurLqB73YIuyn0dfd6l2Vz2DftaUr3Lg 75R0C8RMFnj08zrAR+WRpYE8XRpFXa3UiT9Gu4NeZn2r X-Google-Smtp-Source: ABdhPJz1TgW27H8oI9nQlFbyx9iiBfJJdgWSOWG9dSQ8ulO1iTmpQ86rTWN5UfMkVBD1uv74Qp+X3+6n1/0wjsvTnjc= X-Received: by 2002:a67:43c1:: with SMTP id q184mr25071325vsa.50.1634508916834; Sun, 17 Oct 2021 15:15:16 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> In-Reply-To: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Mon, 18 Oct 2021 00:15:05 +0200 Message-ID: <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> Content-Type: multipart/mixed; boundary="0000000000005ede9b05ce93c32a" X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 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: -1.0 (-) --0000000000005ede9b05ce93c32a Content-Type: multipart/alternative; boundary="0000000000005ede9905ce93c328" --0000000000005ede9905ce93c328 Content-Type: text/plain; charset="UTF-8" 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 --0000000000005ede9905ce93c328 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div class=3D"gmail_quote" dir=3D"auto"><div dir=3D"ltr">= <div>Hello,<br></div><div>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 r= e_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" outpu= t 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` variab= le equals NULL - which means the loop was not executed.<br></div><div><br><= /div><div>I'm sending the patch with the fix in the attachment.</div><d= iv><br></div><div>Best regards,</div><div>Tomasz Dziendzielski</div></div> </div></div> --0000000000005ede9905ce93c328-- --0000000000005ede9b05ce93c32a Content-Type: application/x-patch; name="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Disposition: attachment; filename="0001-grep-Don-t-print-line-if-matcher-returned-nothing.patch" Content-Transfer-Encoding: base64 Content-ID: <f_kuvoabg80> X-Attachment-Id: f_kuvoabg80 RnJvbSAwNzgwNTI1OWI5YmYzZTE2Nzg0N2ExY2Y1MzA4YjZjNTQwMThiNzA5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUb21hc3ogRHppZW5kemllbHNraSA8dG9tYXN6LmR6aWVuZHpp ZWxza2lAZ21haWwuY29tPgpEYXRlOiBTdW4sIDE3IE9jdCAyMDIxIDIxOjQ3OjI4ICswMjAwClN1 YmplY3Q6IFtQQVRDSF0gZ3JlcDogRG9uJ3QgcHJpbnQgbGluZSBpZiBtYXRjaGVyIHJldHVybmVk IG5vdGhpbmcKCkl0IGNhbiBoYXBwZW4gdGhhdCByZV9zZWFyY2ggaW4gRUdleGVjdXRlIGZhaWxz IGFuZCByZXR1cm5zIG5vdGhpbmcgc28KZm9yIGxvb3AgaW4gcHJpbnRfbGluZV9taWRkbGUgcnVu cyB6ZXJvIHRpbWVzIGJ1dCBzdGlsbCBzdGlsbCByZXR1cm5zCnRyYXNoIHVuZGVyIGBjdXJgIHZh cmlhYmxlLCBzbyBncmVwIHRoaW5rcyBpdCBtYXRjaGVkIHNvbWV0aGluZyBhbmQgdGhlbgpyZXR1 cm5zIHdob2xlIGxpbmUuCgpGaXhlcyBidWcgMzk2NzguIElzc3VlIHdhcyB0aGF0IHNlY29uZCBv ZiBiZWxvdyBjb21tYW5kcyBkaWQgbm90IGNvbG9yCnRoZSAiYSIgY2hhcmFjdGVyOgp8IGVjaG8g YSB8IGdyZXAgLWkgLS1jb2xvciAnXEEnCnwgZWNobyBhIHwgZ3JlcCAtaSAtLWNvbG9yICdcYScK YnV0IGluIGZhY3QgaXQgc2hvdWxkbid0IGV2ZW4gcHJpbnQgaXQgaW4gdGhlIGZpcnN0IHBsYWNl LCBzaW5jZSBnbnVsaWIKcmVnZXggZG9lc24ndCBtYXRjaCBpdC4KCiogc3JjL2dyZXAuYzogcHJp bnRfbGluZV9taWRkbGU6IFJldHVybiBOVUxMIGlmIG1hdGNoIG5vdCBmb3VuZCBhbmQgZm9yCmxv b3Agbm90IGV4ZWN1dGVkCgpTaWduZWQtb2ZmLWJ5OiBUb21hc3ogRHppZW5kemllbHNraSA8dG9t YXN6LmR6aWVuZHppZWxza2lAZ21haWwuY29tPgotLS0KIHNyYy9ncmVwLmMgfCA0ICsrKy0KIDEg ZmlsZSBjaGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQg YS9zcmMvZ3JlcC5jIGIvc3JjL2dyZXAuYwppbmRleCBhNTUxOTRjZjFhYTkwNzJlY2MzN2ExMzU3 NGJjNTg4MTY3ZWU1ZDk0Li5iMzcyZTM0MTVjY2JmNmY4OTYwMzlhNmQ3MmJkNmMzNDk4ZDhjMjY5 IDEwMDY0NAotLS0gYS9zcmMvZ3JlcC5jCisrKyBiL3NyYy9ncmVwLmMKQEAgLTEyMTMsNyArMTIx Myw3IEBAIHByaW50X2xpbmVfbWlkZGxlIChjaGFyICpiZWcsIGNoYXIgKmxpbSwKICAgcHRyZGlm Zl90IG1hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQgPSBOVUxMOwotICBj aGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9IGJlZzsKICAgICAgICAo Y3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9saW5lX21pZGRsZSAoY2hhciAq YmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBlbHNlIGlmIChtaWQpCiAgICAgY3Vy ID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisgICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0 dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --0000000000005ede9b05ce93c32a--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: grep --ignore-case --color does not always color the matches References: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> In-Reply-To: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@HIDDEN> Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 04:00:06 +0000 Resent-Message-ID: <handler.39678.B39678.163452958432612 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 39678 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-grep@HIDDEN X-Debbugs-Original-Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163452958432612 (code B ref 39678); Mon, 18 Oct 2021 04:00:06 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 03:59:44 +0000 Received: from localhost ([127.0.0.1]:45560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcJoO-0008Tp-0S for submit <at> debbugs.gnu.org; Sun, 17 Oct 2021 23:59:44 -0400 Received: from mail-lf1-f49.google.com ([209.85.167.49]:34305) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcEcD-0000FQ-N8 for 39678 <at> debbugs.gnu.org; Sun, 17 Oct 2021 18:26:50 -0400 Received: by mail-lf1-f49.google.com with SMTP id t9so62334171lfd.1 for <39678 <at> debbugs.gnu.org>; Sun, 17 Oct 2021 15:26:49 -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=gLVVFjL5ZroNGqGJeBCTlFkZo2ZSPzVByp5UYCTCwK3q0XG4EGaTWzqBeUiP6YbUCl w85Z3w4y+3z8vw8fHcjCrmCfu+HUCq+3d/jWwPJed6G2WFnZwaca+tVKCy5rgYnazQxU IxarmFExj6x6h/wtwIErguVKBbBqaBg27giJo1avY8RYxtDEoT8s4VDVUO8x4N1A57hz blDEXTOcWF4knyqm82IfGB0tJ02F0nA5GIImmmxHRp2hINqQ8Qu2KgOsLkGTGCdgKdBp QK5+u2HmcIY9ky/xXoPb3GONtrpQKFpfGqXkxy7kEk7RuFJ+W2wYmtrrxN67Se8L3c/k WjmA== X-Gm-Message-State: AOAM531RxhLku1Vz3zPeLL09FLlkI2YoCXCg/qejAZigz4VhPcA+3dIW elzN11mc7eKEAS0ZfRvPXSFyApnuM7gO0A== 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 From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 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: -1.0 (-) 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 CnwgZWNobyBhIHwgZ3JlcCAtaSAtLWNvbG9yICdcYScKYnV0IGluIGZhY3QgaXQgc2hvdWxk bid0IGV2ZW4gcHJpbnQgaXQgaW4gdGhlIGZpcnN0IHBsYWNlLCBzaW5jZSBnbnVsaWIKcmVn ZXggZG9lc24ndCBtYXRjaCBpdC4KCiogc3JjL2dyZXAuYzogcHJpbnRfbGluZV9taWRkbGU6 IFJldHVybiBOVUxMIGlmIG1hdGNoIG5vdCBmb3VuZCBhbmQgZm9yCmxvb3Agbm90IGV4ZWN1 dGVkCgpTaWduZWQtb2ZmLWJ5OiBUb21hc3ogRHppZW5kemllbHNraSA8dG9tYXN6LmR6aWVu ZHppZWxza2lAZ21haWwuY29tPgotLS0KIHNyYy9ncmVwLmMgfCA0ICsrKy0KIDEgZmlsZSBj aGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9z cmMvZ3JlcC5jIGIvc3JjL2dyZXAuYwppbmRleCBhNTUxOTRjZjFhYTkwNzJlY2MzN2ExMzU3 NGJjNTg4MTY3ZWU1ZDk0Li5iMzcyZTM0MTVjY2JmNmY4OTYwMzlhNmQ3MmJkNmMzNDk4ZDhj MjY5IDEwMDY0NAotLS0gYS9zcmMvZ3JlcC5jCisrKyBiL3NyYy9ncmVwLmMKQEAgLTEyMTMs NyArMTIxMyw3IEBAIHByaW50X2xpbmVfbWlkZGxlIChjaGFyICpiZWcsIGNoYXIgKmxpbSwK ICAgcHRyZGlmZl90IG1hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQg PSBOVUxMOwotICBjaGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9 IGJlZzsKICAgICAgICAoY3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9s aW5lX21pZGRsZSAoY2hhciAqYmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBl bHNlIGlmIChtaWQpCiAgICAgY3VyID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisg ICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --------------77RGBoYuUJoxVSEgbyGMIsAF--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Paul Eggert <eggert@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 04:09:01 +0000 Resent-Message-ID: <handler.39678.B39678.16345301271254 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.16345301271254 (code B ref 39678); Mon, 18 Oct 2021 04:09:01 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 04:08:47 +0000 Received: from localhost ([127.0.0.1]:45598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcJx8-0000K9-79 for submit <at> debbugs.gnu.org; Mon, 18 Oct 2021 00:08:47 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mcJx0-0000Jp-1s for 39678 <at> debbugs.gnu.org; Mon, 18 Oct 2021 00:08:44 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9099F160051; Sun, 17 Oct 2021 21:08:31 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id H1saES2S5nVt; Sun, 17 Oct 2021 21:08:31 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E85D516005E; Sun, 17 Oct 2021 21:08:30 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qLi4SegSGKnN; Sun, 17 Oct 2021 21:08:30 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id C3822160051; Sun, 17 Oct 2021 21:08:30 -0700 (PDT) Message-ID: <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> Date: Sun, 17 Oct 2021 21:08:30 -0700 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 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) 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: -3.4 (---) On 10/17/21 15:15, Tomasz Dziendzielski wrote: > It's being printed even when re_search in EGexecute doesn't return a match. Gexecute should return a match, though, right? This is because the pattern '\a' matches the data 'a'. So it sounds like the bug is in EGexecute somewhere, not in its caller.
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: Fwd: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 04:46:02 +0000 Resent-Message-ID: <handler.39678.B39678.16345323104625 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.16345323104625 (code B ref 39678); Mon, 18 Oct 2021 04:46:02 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 04:45:10 +0000 Received: from localhost ([127.0.0.1]:45624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcKWM-0001CW-EP for submit <at> debbugs.gnu.org; Mon, 18 Oct 2021 00:45:10 -0400 Received: from mail-ua1-f51.google.com ([209.85.222.51]:36569) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcKWH-0001Bg-7y for 39678 <at> debbugs.gnu.org; Mon, 18 Oct 2021 00:45:07 -0400 Received: by mail-ua1-f51.google.com with SMTP id e10so3449976uab.3 for <39678 <at> debbugs.gnu.org>; Sun, 17 Oct 2021 21:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=omKmCPxjkFAHubz2dnbVD6Gezr06FkRJqnj2CQQW8Zo=; b=XEfkPBs29nHBnJrAsb4MTHnNMT+lul6QOnvbhOVl2Xp5ifoohO0qdEdcywdK6LDUqp rMZ9Vlek9A1FR+u2n7JmHUXXCuVBpVXKwI9EtltDZYPnQwKcbwqn/4r2ZWHfnXaIezQ6 RrEBGbTETdC4QVyYRLtxMLwC0cbtNPRXHe4EpOTi9G+IGqggr4iChWpgeybDKvuVjZm6 xEVj0Lphbejdo+4WpnWuWSie2UQsiUdAg2quJVFjtO76GJt++7P+ZGTgNNPFkzaZz6ny jerBLIcxDTx8RE2a63VdEHqOkwjLvMb1qHsX/ot2968/diY9o1iv6a2ux/4cDQwvR59u WH7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=omKmCPxjkFAHubz2dnbVD6Gezr06FkRJqnj2CQQW8Zo=; b=2ZUdX++sfDnw0shM9cl+mEHEUQ7XaY7vb9nlq0QJP7igF+gjNopENhlQWjHvMPCHZs JKqsv0il33oZFRL6sq07UvxT3dqFng1/u5z2nQi0NaA58jPGz79Ir0iCbCCzS0jbCJVJ HT2MnQ/LkhROCVtmWgoHk8/siBtnHYM+as+1JoUJkLPRAOV28OpzJ4dCbSd24Xucs3PB +MDgK34DNLGPW5uHmPu5LTTe5pzVlw6iO+8zrDR7ZR8E0KQCOceAFvpMs8DdEPeEf4lK jhKP2R7JrxKtfy9jONRjZB0DZn3FzmhGoU6STZIfMk04j1lJ4e9rYBoI9qLBeNeNnClr uE3A== X-Gm-Message-State: AOAM533BJzQlY+Qm12tcQ9aDZmeLSpKkwuJ0azfb9UEKfLGArzEJBqTn lXx6fg06O7f0pG9Sona2Uiu/6MBd97cQk5Oyxl9WoVWTmKg= X-Google-Smtp-Source: ABdhPJxzE4NxCj8pmHkxBDkJsz5aYeEX9heVvud9krcEV61sq8UDtZKvJA2ezeCYrA5aNpoMpUCMb7Wuksm7UJw8CcQ= X-Received: by 2002:a67:d606:: with SMTP id n6mr24790562vsj.51.1634532299579; Sun, 17 Oct 2021 21:44:59 -0700 (PDT) MIME-Version: 1.0 References: <01bd984d-cd59-3b37-6960-763f962f39ff@HIDDEN> <0b8032a0-df81-fadf-d532-6d2246c9cff5@HIDDEN> <CAJkqNs17mh_CQ8h-MbzZA1iTGsOi69-S=hNa8dJ8QYSHbmbGMw@HIDDEN> In-Reply-To: <CAJkqNs17mh_CQ8h-MbzZA1iTGsOi69-S=hNa8dJ8QYSHbmbGMw@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Mon, 18 Oct 2021 06:44:48 +0200 Message-ID: <CAJkqNs2dPrL0C5dzfdwPFxZki+a4b5hppM44GzHjPrDnS8VVzg@HIDDEN> Content-Type: multipart/alternative; boundary="00000000000017237505ce993577" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --00000000000017237505ce993577 Content-Type: text/plain; charset="UTF-8" Hi, sorry for producing such a spam, there was huge 7h delay between my mail and the reply from the mailing list, so I thought something was not sent correctly on my side. >EGexecute should return a match, though, >right? The pattern '\a' matches >the data 'a'. So the bug is in EGexecute >somewhere, not in its caller. Thanks for the reply. In my opinion the bug is not in the EGexecute, since it uses re_search (from gnulib) and the re_search is not returning a match. So there is no problem in EGexecute. I also compared python re.search with \a also don't return a match and I found \a can be interpreted a bell or alarm. It's good to mention that the lack of match happens for all lowercase characters that are not defined in regex (for example echo "j" | grep -i --color '\j'. Comparing to python, they don't allow us to escape any incorrect lowercase characters, for example: >>>re.search("\j","j", re.IGNORECASE) re.error: bad escape \j at position 0 Due to that I think grep should also ignore the non-maching/bad character instead of printing them. Best regards, Tomasz Dziendzielski --00000000000017237505ce993577 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><span style=3D"font-family:sans-serif">Hi,<br></span><div = class=3D"gmail_quote"><div dir=3D"ltr"><div><span style=3D"font-family:sans= -serif">sorry for producing such a spam, there was huge 7h delay between my= mail and the reply from the mailing list, so I thought something was not s= ent correctly on my side.<span><span></span></span></span></div><div dir=3D= "auto"><span style=3D"font-family:sans-serif"><br></span></div><div dir=3D"= auto"><span style=3D"font-family:sans-serif">>EGexecute should return a = match, though,</span><div dir=3D"auto"><span style=3D"font-family:sans-seri= f">>right? The pattern '\a' matches</span><br style=3D"font-fami= ly:sans-serif"><span style=3D"font-family:sans-serif">>the data 'a&#= 39;. So the bug is in EGexecute >somewhere, not in its caller.</span></d= iv><div><font face=3D"sans-serif">Thanks for the reply. In my opinion the b= ug is not in the EGexecute, since it uses re_search (from gnulib) and the r= e_search is not returning a match. So there is no problem in EGexecute. I a= lso compared python re.search with \a also don't return a match and I f= ound \a can be interpreted a bell or alarm.<br>It's good to mention tha= t the lack of match happens for all lowercase characters that are not defin= ed in regex (for example echo "j" | grep -i --color '\j'.= Comparing to python, they don't allow us to escape any incorrect lower= case characters, for example:<br>>>>re.search("\j","= ;j", re.IGNORECASE)</font></div><div><font face=3D"sans-serif">re.erro= r: bad escape \j at position 0</font></div><div><font face=3D"sans-serif">D= ue to that I think grep should also ignore the non-maching/bad character in= stead of printing them.<br></font></div><div><font face=3D"sans-serif"><br>= </font></div><div><font face=3D"sans-serif">Best regards,</font></div><div>= <font face=3D"sans-serif">Tomasz Dziendzielski<br></font></div></div> </div> </div></div> --00000000000017237505ce993577--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 04:52:01 +0000 Resent-Message-ID: <handler.39678.B39678.16345326965312 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert <eggert@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.16345326965312 (code B ref 39678); Mon, 18 Oct 2021 04:52:01 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 04:51:36 +0000 Received: from localhost ([127.0.0.1]:45628 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcKca-0001Nb-7O for submit <at> debbugs.gnu.org; Mon, 18 Oct 2021 00:51:36 -0400 Received: from mail-ua1-f43.google.com ([209.85.222.43]:43763) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcKcV-0001NL-2g for 39678 <at> debbugs.gnu.org; Mon, 18 Oct 2021 00:51:34 -0400 Received: by mail-ua1-f43.google.com with SMTP id i22so1561198ual.10 for <39678 <at> debbugs.gnu.org>; Sun, 17 Oct 2021 21:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Aa0MEve8027TVUCo4Pc4favk+0MxjZYUnPONripuLvE=; b=Rxc/O2B0zAqBJ6GqDo6bpH8JhmHFSyqbTcFGeqkmznj1OuQJjAlMwFeCIxcy2OaXub +MVLlvA0FgrJGCCGl7eHz4lxkEzHG1yJeiSbtb4iWE3KXPfVyJNtgfuO3TIS30ERk7Vg JQYY+hi3Jgi7os+C4ujbjrCtufoRibt1Z9nV9XPLz/RfVvtjjZEOY1aC/GIpfhizY3iM SrSZG3L2zSIZaq6XhO5SPcJie1fzuPy+Dd69n7QC8tR0exFR3hJp+noH+5SzpXhmylCU 839Y94OaZSHujKQRzkuTmN4KXIZz61Rvh1h+wmykoK5njOBqkFH3FwTqA6/vRU43/7HQ d8kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Aa0MEve8027TVUCo4Pc4favk+0MxjZYUnPONripuLvE=; b=mE8pWX+jdGai/byVhZdWnGhRCotBKaUMCYRsPEv2aXTU82mOXJPmK+fDYmhKhJzk3F eRoQzRfLtlSMsVpgGuXlsxabVCipg7G9ZBI057Dv9ZsQTnO3t7zcLUV7ee71rNmCYRth Ike8SVfQHEkWXSNPnFz8EtdqzFpKHPA0NrbPZZiB9Q87Herppt9+0tpJBl42H02aNb2O Kk02XUfPHG081VMKWxjcdTOMo7OZrtDcffAa1OzwevlFVkP1pPGWNTkbQgOI1fZswPMK 8YRB2XDTh+YMilWM4edWZmqV8PnweaYelZbJSsjTkHlwXKcWodWDWiLvQDqJaX0m9V1m IKgw== X-Gm-Message-State: AOAM533hd4SfEbadZjAzSGk3CvTtLRMteGq6VGRUo7XN8r5hmnOEJryZ O6jSTsHRWtEA/4UwOANZLSqafew+TCFpADhUSmLvSv2LSKycuQ== X-Google-Smtp-Source: ABdhPJzxLieoh7ZlQbepo6fzlgWA2NE6vbxjcmyNuKsRyT5ZhEdsamjzmbSfDsK7TlZIfOAtCdt77Jt/Kn7CG59gvjI= X-Received: by 2002:ab0:5542:: with SMTP id u2mr23858642uaa.62.1634532685508; Sun, 17 Oct 2021 21:51:25 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> In-Reply-To: <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Mon, 18 Oct 2021 06:53:01 +0200 Message-ID: <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> Content-Type: multipart/alternative; boundary="00000000000017f44c05ce994c27" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --00000000000017f44c05ce994c27 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable >EGexecute should return a match, though, >right? The pattern '\a' matches >the data 'a'. So the bug is in EGexecute >somewhere, not in its caller. Thanks for the reply. In my opinion the bug is not in the EGexecute, since it uses re_search (from gnulib) and the re_search is not returning a match. So there is no problem in EGexecute. I also compared python re.search with \a also don't return a match and I found \a can be interpreted a bell or alarm. It's good to mention that the lack of match happens for all lowercase characters that are not defined in regex (for example echo "j" | grep -i --color '\j'. Comparing to python, they don't allow us to escape any incorrect lowercase characters, for example: >>>re.search("\j","j", re.IGNORECASE) re.error: bad escape \j at position 0 Due to that I think grep should also ignore the non-maching/bad character instead of printing them. Best regards, Tomasz Dziendzielski pon., 18 pa=C5=BA 2021 o 06:08 Paul Eggert <eggert@HIDDEN> napisa=C5= =82(a): > On 10/17/21 15:15, Tomasz Dziendzielski wrote: > > It's being printed even when re_search in EGexecute doesn't return a > match. > > Gexecute should return a match, though, right? This is because the > pattern '\a' matches the data 'a'. So it sounds like the bug is in > EGexecute somewhere, not in its caller. > --00000000000017f44c05ce994c27 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"auto"><span class=3D"gmail-im"><span style=3D"= font-family:sans-serif">>EGexecute should return a match, though,</span>= <div dir=3D"auto"><span style=3D"font-family:sans-serif">>right? The pat= tern '\a' matches</span><br style=3D"font-family:sans-serif"><span = style=3D"font-family:sans-serif">>the data 'a'. So the bug is in= EGexecute >somewhere, not in its caller.</span></div></span><div><font = face=3D"sans-serif">Thanks for the reply. In my opinion the bug is not in the EGexecute, since it=20 uses re_search (from gnulib) and the re_search is not returning a match. So there is no problem in EGexecute. I also compared python re.search=20 with \a also don't return a match and I found \a can be interpreted a= =20 bell or alarm.<br>It's good to mention that the lack of match happens= =20 for all lowercase characters that are not defined in regex (for example=20 echo "j" | grep -i --color '\j'. Comparing to python, the= y don't allow=20 us to escape any incorrect lowercase characters, for example:<br>>>&g= t;re.search("\j","j", re.IGNORECASE)</font></div><div><= font face=3D"sans-serif">re.error: bad escape \j at position 0</font></div>= <div><font face=3D"sans-serif">Due to that I think grep should also ignore = the non-maching/bad character instead of printing them.<br></font></div><di= v><font face=3D"sans-serif"><br></font></div><div><font face=3D"sans-serif"= >Best regards,</font></div><div><font face=3D"sans-serif">Tomasz Dziendziel= ski<br></font></div></div></div><br><div class=3D"gmail_quote"><div dir=3D"= ltr" class=3D"gmail_attr">pon., 18 pa=C5=BA 2021 o 06:08=C2=A0Paul Eggert &= lt;<a href=3D"mailto:eggert@HIDDEN">eggert@HIDDEN</a>> napisa= =C5=82(a):<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0= px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 10= /17/21 15:15, Tomasz Dziendzielski wrote:<br> > It's being printed even when re_search in EGexecute doesn't re= turn a match.<br> <br> Gexecute should return a match, though, right? This is because the <br> pattern '\a' matches the data 'a'. So it sounds like the bu= g is in <br> EGexecute somewhere, not in its caller.<br> </blockquote></div> --00000000000017f44c05ce994c27--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 05:12:02 +0000 Resent-Message-ID: <handler.39678.B39678.16345338627420 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert <eggert@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.16345338627420 (code B ref 39678); Mon, 18 Oct 2021 05:12:02 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 05:11:02 +0000 Received: from localhost ([127.0.0.1]:45633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcKvO-0001vb-1S for submit <at> debbugs.gnu.org; Mon, 18 Oct 2021 01:11:02 -0400 Received: from mail-ua1-f47.google.com ([209.85.222.47]:34383) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcKvM-0001v8-Vx for 39678 <at> debbugs.gnu.org; Mon, 18 Oct 2021 01:11:01 -0400 Received: by mail-ua1-f47.google.com with SMTP id h4so2121315uaw.1 for <39678 <at> debbugs.gnu.org>; Sun, 17 Oct 2021 22:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FYSqcZr1CPSYmo8ry1iy4aHgMaACoGfbl33lJDu0aM0=; b=nJLPpDv6TZnXFeP3hxe0+hKZOo+22FsL8Fz96b6Q5Hds4+Zm3XLDAWl+hn+UAsQRbO UMcFn6+YXahEi5HldoDBV5i/7vNNG8WtSoaCFM+A7HZhRsBpyXTwNR3Gv/iwueKthcNq v99YlCIDQSwG6Q/UDBOtMu9ImBVQX7ibjFreA82r1UuA1MvmWp1LIhybmTwaBbNST1RR hDOKFzYuiczBucn2AxjlZ2cQGS35C5lphM3tNyeslxAruLAHL4rlbjKN0QJlrHY0pE1w wWPwn/uEEozuB2k4scb66ZmF/eQqdzlRXww2CNjOmCS8dX1eSuJQy0DOR+M+B37AvraU MZPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FYSqcZr1CPSYmo8ry1iy4aHgMaACoGfbl33lJDu0aM0=; b=V61MnKk6OcguA1VRgSGAYkqjscQrqA/RUfvgIjZcklDtWylIx8wR6BI7T7SP1hlSvH h0w5tihDg67SSqgRI2lNbD3w496YoyDWFsXz0aUw867R1IljCsELWsO5xjxgqGqndasP tTl0QRsO0tOFvRdAsaSkBVeGJfbHwBauD83a+yyOVnsqNqP8qQbkRvmAhBMA+Ivx5xrX ClEolR8ym/XZUQi+6AmsAjCPgZelUofyuZ748AGdx7NuNHY/R/23U6dzWtyEWZ7vwHcU VDTGOEYuuPcntXepcf1kCmo2ubrQ+2wXg15uQALz5JNUDQH1Q8anAHEfZl2vOp7OiVSM 52Pg== X-Gm-Message-State: AOAM53264ogE7mAasFNn30iMugzpJrZ/0Nrfv/cw87LaV+NXpc2HHpjO kEt9mdWFFD3PhaJ2k+fTszFmcnvEcgOS94IcVIZgB5+f2KA= X-Google-Smtp-Source: ABdhPJwVmhxEWDrQmSmEkBY8Ei8YrI3jf0sNJv0FWQ5kGv8Gy7XP/8x4scrvMO5F+jMTxo1yIsQuYv7WXLE3dYPiNHk= X-Received: by 2002:a67:d606:: with SMTP id n6mr24828311vsj.51.1634533855542; Sun, 17 Oct 2021 22:10:55 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> In-Reply-To: <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Mon, 18 Oct 2021 07:10:44 +0200 Message-ID: <CAJkqNs1u9hLHCkBq22goStLAnbdrVwbUt5BA7n_EjVRJib8SWQ@HIDDEN> Content-Type: multipart/alternative; boundary="000000000000d540a405ce9991bf" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --000000000000d540a405ce9991bf Content-Type: text/plain; charset="UTF-8" Also, even if we assume it should return a match (which I think it shouldn't), then there's a second bug in print_line_middle, because why would it print anything if there was no match? Best regards, Tomasz Dziendzielski --000000000000d540a405ce9991bf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">Also, even if we assume it should return a match (which I= think it shouldn't), then there's a second bug in print_line_middl= e, because why would it print anything if there was no match?<div dir=3D"au= to"><br></div><div dir=3D"auto">Best regards,</div><div dir=3D"auto">Tomasz= Dziendzielski</div></div> --000000000000d540a405ce9991bf--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 13:38:01 +0000 Resent-Message-ID: <handler.39678.B39678.16345642563163 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert <eggert@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.16345642563163 (code B ref 39678); Mon, 18 Oct 2021 13:38:01 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 13:37:36 +0000 Received: from localhost ([127.0.0.1]:46288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcSpb-0000ow-Lw for submit <at> debbugs.gnu.org; Mon, 18 Oct 2021 09:37:35 -0400 Received: from mail-ua1-f50.google.com ([209.85.222.50]:41628) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcSpZ-0000oi-1Y for 39678 <at> debbugs.gnu.org; Mon, 18 Oct 2021 09:37:33 -0400 Received: by mail-ua1-f50.google.com with SMTP id r17so1306725uaf.8 for <39678 <at> debbugs.gnu.org>; Mon, 18 Oct 2021 06:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rR2KK2bp7ajjqmHf6mwllHJgRGpNjpJcxX6tjo9Ly84=; b=hXTy8Xka8O8s7q4VugbyMoVnS/jhKTERWmKVymSnikncXoqneejrkpzyxpuCiIM05d iY3wV6b3olB4+3C5d9O1pxXrFzPDvpy3ir2NF9U6f5eS/1OBXGpUbjMnq7oZWhdDBzWm 3+gPYJqbM+tulKlUTyEDJ9vYjrhexJjcEDgXdHoKASHHQf2I4MrfDYrFF5hmMnwvzKrn j8IYCU8R/e3NgEhdGbOXb7JPuX6eW+FKG5yMITNjLsEKeiqV0S8PUjHWrn2lmPO4gl3V /T8aLE+6MdrzNhQaQ4aANXmD4BQX7GhD+M0hoPAY9nT7K05tfIVEod89kbH61yp6IYDK 9Vow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rR2KK2bp7ajjqmHf6mwllHJgRGpNjpJcxX6tjo9Ly84=; b=FBmC2u0knOGOoQ4uc1loaDx+cMejgUobcsNQG4YKRcOojWCXaG7gsh6oPEXPlff4yU ttbnf18c861pOrdJjO0f9VAIt5Req8nvmEntOZ9iNh0RXuluG7aGhXwoCrnqNFb521GN rx86mFDMhUldBujWrWN2BVG5bRHBlKP9Z2PdFEjgEalKQ7BWdZ8rzcx//E4VOnfPPyEK NllirTXaWq0n9P1goXE/9X8/y6sYoNzC0kCv8u3py22peJTjRZPMOF/9HmfwXgzjOEa6 JPrDd5BUF80cwimzbK4+WnDdboRqNEMbaqkrtWLSTfgjsnNhL9VC5l613Ec9LLQeSfoC 1KNQ== X-Gm-Message-State: AOAM532ZSW/e6P9WUNDbjCtUVtAu9arpu33z451w95RVJKMcsg8tGFUb WaE7nQcfX24SlVoX1ZDegowp/S/nfc8ToE9W6LY= X-Google-Smtp-Source: ABdhPJze01yce/cU3+CetRwECvma6I/+HJ+hIutLKfzH390/ejkFkuHMLxMkcJWA+qWjir2oE5hQvYamGduVGM3oX+0= X-Received: by 2002:a67:e28a:: with SMTP id g10mr27700057vsf.5.1634564247465; Mon, 18 Oct 2021 06:37:27 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> <CAJkqNs1u9hLHCkBq22goStLAnbdrVwbUt5BA7n_EjVRJib8SWQ@HIDDEN> In-Reply-To: <CAJkqNs1u9hLHCkBq22goStLAnbdrVwbUt5BA7n_EjVRJib8SWQ@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Mon, 18 Oct 2021 15:39:03 +0200 Message-ID: <CAJkqNs1wRFC5d2ADh=-E1uxio-KkNnkypdmwXz-CZ2eBe053EQ@HIDDEN> Content-Type: multipart/alternative; boundary="00000000000055323e05cea0a59b" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --00000000000055323e05cea0a59b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Additional note, according to POSIX regex standard: "An ordinary character is a BRE that matches itself: any character in the supported character set, except for the BRE special characters listed in BRE Special Characters. The interpretation of an ordinary character preceded by an unescaped <backslash> ( '\\' ) is undefined, except for: [...]" which means that escaping ordinary characters (like \a) has undefined behaviour, thus I think it should not be matched. So having EGexecute match 'a' to '\a' is incorrect, and instead we should remove the matching and make sure it's not printed. That would make my patch correct. Reference: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#ta= g_09_03_03 Looking forward to feedback. Best regards, Tomasz Dziendzielski pon., 18 pa=C5=BA 2021 o 07:10 Tomasz Dziendzielski < tomasz.dziendzielski@HIDDEN> napisa=C5=82(a): > Also, even if we assume it should return a match (which I think it > shouldn't), then there's a second bug in print_line_middle, because why > would it print anything if there was no match? > > Best regards, > Tomasz Dziendzielski > --00000000000055323e05cea0a59b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Additional note, according to POSIX regex standard:<b= r></div><div>"An ordinary character is a BRE that matches itself: any = character in the supported character set, except for the BRE special characters listed in BRE Special Characters.</div><div>The interpretation o= f an ordinary character preceded by an unescaped <backslash> ( <tt>&#= 39;\\'</tt> ) is undefined, except for: [...]"</div><div>which means that escaping ordinary characters (l= ike \a) has undefined behaviour, thus I think it should not be matched.</di= v><div>So having EGexecute match 'a' to '\a' is incorrect, = and instead we should remove the matching and make sure it's not printe= d. That would make my patch correct.<br></div><div><br></div><div>Reference= : <a href=3D"https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_c= hap09.html#tag_09_03_03">https://pubs.opengroup.org/onlinepubs/9699919799/b= asedefs/V1_chap09.html#tag_09_03_03</a></div><div><br></div><div>Looking fo= rward to feedback.<br></div><div><br></div><div>Best regards,</div><div>To= masz Dziendzielski<br></div></div><br><div class=3D"gmail_quote"><div dir= =3D"ltr" class=3D"gmail_attr">pon., 18 pa=C5=BA 2021 o 07:10=C2=A0Tomasz Dz= iendzielski <<a href=3D"mailto:tomasz.dziendzielski@HIDDEN">tomasz.dz= iendzielski@HIDDEN</a>> napisa=C5=82(a):<br></div><blockquote class= =3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg= b(204,204,204);padding-left:1ex"><div dir=3D"auto">Also, even if we assume = it should return a match (which I think it shouldn't), then there's= a second bug in print_line_middle, because why would it print anything if = there was no match?<div dir=3D"auto"><br></div><div dir=3D"auto">Best regar= ds,</div><div dir=3D"auto">Tomasz Dziendzielski</div></div> </blockquote></div> --00000000000055323e05cea0a59b--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 15:41:02 +0000 Resent-Message-ID: <handler.39678.B39678.163457161124949 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert <eggert@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163457161124949 (code B ref 39678); Mon, 18 Oct 2021 15:41:02 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 15:40:11 +0000 Received: from localhost ([127.0.0.1]:48296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcUkE-0006UL-N3 for submit <at> debbugs.gnu.org; Mon, 18 Oct 2021 11:40:10 -0400 Received: from mail-ua1-f54.google.com ([209.85.222.54]:34477) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcUkA-0006Tb-6G for 39678 <at> debbugs.gnu.org; Mon, 18 Oct 2021 11:40:09 -0400 Received: by mail-ua1-f54.google.com with SMTP id h4so5322732uaw.1 for <39678 <at> debbugs.gnu.org>; Mon, 18 Oct 2021 08:40:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SiqCap5jN5BrNXLCJ3gfJy3TlfX6xD7aHbHH2oCajg8=; b=KUyOP+ayzgZB8FnAqRn0NCm/jGYzRMJlF3usEOi7hmvji63xJ/xnWqqAHi9AcyB8w/ VVvJMynTVI1v8Dl3kn6wwQXOX68f3ZJSABIzHBj8OSqqy/s8JyrelxrIrjkYPvBvZJlz Nzvurnx+nSsknVVjfufU6+RKxa7FsU848G3m7HJpPkP7+FL74X6Xy+aj1ZFvK8mi+fRO hciKRKQdZwfDKV5JksoqOY0u/BedOcAIzZjfv7Oso6JRKHDJCmuKFmdsYVu951/YvDhT k1FHt02fghbnB9auyyM9ZOl5YbJvPWsKanCJ+oEIpdP1K/ZQWqj75uluHuvUEaNsqaZP wP/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SiqCap5jN5BrNXLCJ3gfJy3TlfX6xD7aHbHH2oCajg8=; b=ccaAnnJ6kM8vehXeCcqsrwQgSvEV/CcIeQnQSVrvPKVXPF2URbeH6DgxOI0DztFxVw +7J/ZG/hq5RtNiJcpSFeoJEewr91exvqcwkSypw2r5hPnhpU+wipmm2lIVKGBuO22Gj4 wCp5VcAH/G91xHGWeoemfdaI2/vair6fkAbz8Shg3xrtkdgRUrCnc7LdQHVzPkGgPlEy jwVjYNE4PVMGhC0Oqp1JoghyLwtBY+nK6//vAclmHUqITeKiUh+XXXcw9yyGj3udencU GXvc0OE3CkdyTXXmz0k1cgUodddCGb5vtQ3b/hslNVkg94AcTKtjKDU1W6Y2pfxOXhK+ 0SLw== X-Gm-Message-State: AOAM530N9BcL6N6Z+9RjuwalYSNun0s6hkCRjUT+tyhSQ6/4Mms2sPi6 tWJpRMs1QSZ76UDWJRMBvs1SHqWCr3HItI3JWZPS8U2ExQk= X-Google-Smtp-Source: ABdhPJxLEtG+7kqsb5RFJ1wn5NbbZSYBJKzT0CVru5/IpbkUQvPP/29JwLsnrlHzMefXDk/p0NAMNPF91CQq89yM434= X-Received: by 2002:ab0:458d:: with SMTP id u13mr26463398uau.99.1634571600197; Mon, 18 Oct 2021 08:40:00 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> <CAJkqNs1u9hLHCkBq22goStLAnbdrVwbUt5BA7n_EjVRJib8SWQ@HIDDEN> <CAJkqNs1wRFC5d2ADh=-E1uxio-KkNnkypdmwXz-CZ2eBe053EQ@HIDDEN> In-Reply-To: <CAJkqNs1wRFC5d2ADh=-E1uxio-KkNnkypdmwXz-CZ2eBe053EQ@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Mon, 18 Oct 2021 17:39:49 +0200 Message-ID: <CAJkqNs0CR5bv83oFSJxu-o9ph8+LbMF4fgvzpcz=kFv=jWNDpg@HIDDEN> Content-Type: multipart/alternative; boundary="00000000000096f94805cea25b6f" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --00000000000096f94805cea25b6f Content-Type: text/plain; charset="UTF-8" Now I noticed that it introduces inconsistency, but due to a second problem - that grep prints lines even when there were no matching strings. For example if I run: $ echo "a" | grep -E "{1,3}" $ echo "a" | grep -i "\a" then it returns the string "a" even though it doesn't match anything. With my patch it correctly does not print the string but I think for consistency it also requires adaptations in case --color was not passed. I'll try to work on that. Best regards, Tomasz Dziendzielski --00000000000096f94805cea25b6f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div><div>Now I noticed that it introduces inconsiste= ncy, but due to a second problem - that grep prints lines even when there w= ere no matching strings. For example if I run:<br></div>$ echo "a"= ; | grep -E "{1,3}"</div><div>$ echo "a" | grep -i &quo= t;\a"<br></div>then it returns the string "a" even though it= doesn't match anything. With my patch it correctly does not print the = string but I think for consistency it also requires adaptations in case --c= olor was not passed. I'll try to work on that.<br><br></div><div>Best r= egards,</div><div>Tomasz Dziendzielski<br></div></div> --00000000000096f94805cea25b6f--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 16:12:02 +0000 Resent-Message-ID: <handler.39678.B39678.16345735144330 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert <eggert@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.16345735144330 (code B ref 39678); Mon, 18 Oct 2021 16:12:02 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 16:11:54 +0000 Received: from localhost ([127.0.0.1]:48346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcVEw-00017l-1t for submit <at> debbugs.gnu.org; Mon, 18 Oct 2021 12:11:54 -0400 Received: from mail-ua1-f49.google.com ([209.85.222.49]:42903) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mcVEt-00017Y-GJ for 39678 <at> debbugs.gnu.org; Mon, 18 Oct 2021 12:11:52 -0400 Received: by mail-ua1-f49.google.com with SMTP id j8so480896uak.9 for <39678 <at> debbugs.gnu.org>; Mon, 18 Oct 2021 09:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Nj4l5n/6LI/co8DwTcbn8oAnnRcLZvF4FNRLjldA9x0=; b=VFnkZX6YkZMQhmSCj35cmm5JLU69bhRCRK5BM/Y9TAv7MLADl23+0ka/bW02jTIngo nRgs/HQH3N55YIV+1zACL6NYLHTdpQYpHDk/wtIl77C+8kpqy96PsnD5hOuviy2liKVy kZq/8VbKQSHPzovuUi/AyI/cP1lKECHfPXgfl1Y+Gjfi2/zq1syIyuQseCs+nQvk9RnW PTww59fINHMUJtTR+zdzTWc6vsKlEY6WLtv3T34SHGMcduw2ntcUvUNWQE3bJkYjW5Qv PnK4IOn6deXs9sRrCtWGiJFxbzeDRoGKUhy/7FZYNccu+Yb7M+4ggTuBUoWmk9R769pD KIlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Nj4l5n/6LI/co8DwTcbn8oAnnRcLZvF4FNRLjldA9x0=; b=HnB2I43rK8+pV46utpJMcOR3ci8jMcwH8w9rQhS59yRvMelPiE1Rb3q2dmzF9bpdmH ys5u0cG0RQsgv6yJLrche2UtNfpXTb711XP+CSimHhZROREiWA77vhnt6CFpfG+6Oz/7 xh1qKCEk8nZ/uOv2W2eomNHCpdh98yxvMs2cEUio72TkONhfrnY923qNydQjx1SRJlmH W87WZZ47NLihJu2z9DoIfCvQtu8PUJ6SrU5RsEjdHbiYIUEdKxtMl63lBi7/S7hIggnN fKhIO30NEjFxz8vIUElaIRx2SNM/TexGE5atos1CZCqrDZpPayzyRyHK+7RgqI3eJ4BX hfjA== X-Gm-Message-State: AOAM530gTpYhn53Yg9UknsUX3FtxncyklR/nxuvIxjXHz+PMsGhdTjWc qb8HAcyUUmgoNMNDa6pIq4g2AgwKHnhRqXLYdjM= X-Google-Smtp-Source: ABdhPJy6kG7Rn5vpqGiU4RUTQASRtHPMtE2kP9/PBtbVjQSdkkyNHHodRhVnsqgTSqMmvFiIg5fnfwc3EA69fyZRtOg= X-Received: by 2002:a05:6102:370f:: with SMTP id s15mr6303285vst.41.1634573506020; Mon, 18 Oct 2021 09:11:46 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> <CAJkqNs1u9hLHCkBq22goStLAnbdrVwbUt5BA7n_EjVRJib8SWQ@HIDDEN> <CAJkqNs1wRFC5d2ADh=-E1uxio-KkNnkypdmwXz-CZ2eBe053EQ@HIDDEN> <CAJkqNs0CR5bv83oFSJxu-o9ph8+LbMF4fgvzpcz=kFv=jWNDpg@HIDDEN> In-Reply-To: <CAJkqNs0CR5bv83oFSJxu-o9ph8+LbMF4fgvzpcz=kFv=jWNDpg@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Mon, 18 Oct 2021 18:11:34 +0200 Message-ID: <CAJkqNs13zgRd6s-ceQCtbTGZhLqugEk4njz02_aSxT-mhAkUQw@HIDDEN> Content-Type: multipart/alternative; boundary="0000000000002f877b05cea2cdc4" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --0000000000002f877b05cea2cdc4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable A different inconsistency is in gnulib regex also, which matches 'a' to '\a' but do not match the same if case insensitive is set. I'll still try to work on that. Best regards, Tomasz Dziendzielski pon., 18 pa=C5=BA 2021, 17:39 u=C5=BCytkownik Tomasz Dziendzielski < tomasz.dziendzielski@HIDDEN> napisa=C5=82: > Now I noticed that it introduces inconsistency, but due to a second > problem - that grep prints lines even when there were no matching strings= . > For example if I run: > $ echo "a" | grep -E "{1,3}" > $ echo "a" | grep -i "\a" > then it returns the string "a" even though it doesn't match anything. Wit= h > my patch it correctly does not print the string but I think for consisten= cy > it also requires adaptations in case --color was not passed. I'll try to > work on that. > > Best regards, > Tomasz Dziendzielski > --0000000000002f877b05cea2cdc4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">A different inconsistency is in gnulib regex also, which = matches 'a' to '\a' but do not match the same if case insen= sitive is set. I'll still try to work on that.<div dir=3D"auto"><br></d= iv><div dir=3D"auto">Best regards,</div><div dir=3D"auto">Tomasz Dziendziel= ski</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gma= il_attr">pon., 18 pa=C5=BA 2021, 17:39 u=C5=BCytkownik Tomasz Dziendzielski= <<a href=3D"mailto:tomasz.dziendzielski@HIDDEN">tomasz.dziendzielski= @gmail.com</a>> napisa=C5=82:<br></div><blockquote class=3D"gmail_quote"= style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><d= iv dir=3D"ltr"><div><div><div>Now I noticed that it introduces inconsistenc= y, but due to a second problem - that grep prints lines even when there wer= e no matching strings. For example if I run:<br></div>$ echo "a" = | grep -E "{1,3}"</div><div>$ echo "a" | grep -i "= \a"<br></div>then it returns the string "a" even though it d= oesn't match anything. With my patch it correctly does not print the st= ring but I think for consistency it also requires adaptations in case --col= or was not passed. I'll try to work on that.<br><br></div><div>Best reg= ards,</div><div>Tomasz Dziendzielski<br></div></div> </blockquote></div> --0000000000002f877b05cea2cdc4--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Paul Eggert <eggert@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 18 Oct 2021 17:00:02 +0000 Resent-Message-ID: <handler.39678.B39678.163457637117253 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163457637117253 (code B ref 39678); Mon, 18 Oct 2021 17:00:02 +0000 Received: (at 39678) by debbugs.gnu.org; 18 Oct 2021 16:59:31 +0000 Received: from localhost ([127.0.0.1]:48417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcVz1-0004UD-Gp for submit <at> debbugs.gnu.org; Mon, 18 Oct 2021 12:59:31 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:53902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mcVyy-0004Tv-7X for 39678 <at> debbugs.gnu.org; Mon, 18 Oct 2021 12:59:29 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 114D6160097; Mon, 18 Oct 2021 09:59:21 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id e7heGxyLJ0Zo; Mon, 18 Oct 2021 09:59:20 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 282DC1600C2; Mon, 18 Oct 2021 09:59:20 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ToM_nWvHh70P; Mon, 18 Oct 2021 09:59:20 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 03A9E160097; Mon, 18 Oct 2021 09:59:19 -0700 (PDT) Message-ID: <ee59f460-2783-0f08-3f73-2127a90d00e6@HIDDEN> Date: Mon, 18 Oct 2021 09:59:19 -0700 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 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.4 (--) 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: -3.4 (---) On 10/17/21 21:53, Tomasz Dziendzielski wrote: > Thanks for the reply. In my opinion the bug is not in the EGexecute, since > it uses re_search (from gnulib) and the re_search is not returning a match. > So there is no problem in EGexecute. It seems to me that there is a bug, because the search in question is done to a line for which EGexecute has already reported a match. Therefore, if you search again with the same pattern, you should find at least one match. However, in this buggy case, EGexecute is not finding a match, and this messes up the caller. > even if we assume it should return a match (which I think it > shouldn't), then there's a second bug in print_line_middle, because why > would it print anything if there was no match? It should be able to assume that there is at least one match, so it shouldn't need to worry about the case where there are zero matches. > which means that escaping ordinary characters (like \a) has undefined > behaviour, Yes, and that means this bug is not a POSIX-conformance issue. However, it's still a bug, since '\a' should match 'a' in GNU grep, at least unless and until we decide that \a matches something else. > So having EGexecute match 'a' to '\a' is incorrect Not at all. Undefined behavior means 'grep' can do anything it likes, as far as POSIX is concerned.
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Tue, 19 Oct 2021 18:38:01 +0000 Resent-Message-ID: <handler.39678.B39678.163466862210693 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert <eggert@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163466862210693 (code B ref 39678); Tue, 19 Oct 2021 18:38:01 +0000 Received: (at 39678) by debbugs.gnu.org; 19 Oct 2021 18:37:02 +0000 Received: from localhost ([127.0.0.1]:51987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mctyw-0002mM-2V for submit <at> debbugs.gnu.org; Tue, 19 Oct 2021 14:37:02 -0400 Received: from mail-vk1-f176.google.com ([209.85.221.176]:44964) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mctyt-0002m4-Pm for 39678 <at> debbugs.gnu.org; Tue, 19 Oct 2021 14:37:00 -0400 Received: by mail-vk1-f176.google.com with SMTP id ba39so9812542vkb.11 for <39678 <at> debbugs.gnu.org>; Tue, 19 Oct 2021 11:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aQxeP3nSV/quiWTcHZcbPmCYgqEe0CbaMWeZhf9WZFA=; b=lWmj7hbybE4DsKP642BS8tsmP2KNfApdqRg7UkjaDeYHA/NGWXZPV4JG+ZbtXVOem8 MgJYod5l55DPHmL34/y0hcq2wATAVBWzIKnlxPd4aQuUi/4xfu9RM29I6mvbAStgHYDB 6IjZznHZ1zHZ3oUJDQkEsNvnwLuKU4Dv+X3jrJdhO0UFpaSPkTZrKP55rhqHJ4t4Mr7Y MGGHifWgayVNFf+vbcDOctDP7Mknw5vHLo1LRRPG/RItZs4DVICeJiTOKnN2nCzXAKJY rIsR/aSHE3S4KdmOQ6JRkf8YLa0PppQkkZBTZUhJlSojD9sYgcBAYzVclTf32Gw8QV22 25Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aQxeP3nSV/quiWTcHZcbPmCYgqEe0CbaMWeZhf9WZFA=; b=lDXJbQZRw8OGrvQl7gwfiLY4HVTmMjhJ0T8sk8NgJYfdZZq8GbUBhxozEzP6Xpp1ca o0IBaX1bqQJVC0ve3LyHvBZ7dgnR8AH/WMMe5ncY9Q1aHYv62P1HAmknMfQ0wbPDF5i5 6pAtWW6Dd+BIc3JQyica6qHo8eaJPCN1ar9/t7Ba09tzAwLnQSkGzCPrnO+Lq2ikt50P bZSe7nIfQ6kiuWmqPJe63wCyI2JFaHslK1CGB8+CYQkKAkJ85Kz+QQe5wVBfmV+LF5E0 T7838R8nRcdMcXLVyjMDTK0L3kNvoIm484tIZ0kKwrYyBGIUtebXAJy+y6scHVLfauYk 5Piw== X-Gm-Message-State: AOAM530HbUYR67CmMDToAIcN2e8OGt7/70UBh8A5hnVfV1p0TtcPNw8M 4TGEydfaHQrrIW6DN3QJgQNgWXre6nZYkWv3ZTinNV/nJ5xudiRq X-Google-Smtp-Source: ABdhPJxpAvSdwdXdlW9i4TCHU28JsnqXREWOfa7lFxoDy4vWlMEvpJFtPxWQKehWkRxz4cWVxDgAsP1KJRUgcbBAq80= X-Received: by 2002:a1f:1bc6:: with SMTP id b189mr34082162vkb.15.1634668614231; Tue, 19 Oct 2021 11:36:54 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> <ee59f460-2783-0f08-3f73-2127a90d00e6@HIDDEN> In-Reply-To: <ee59f460-2783-0f08-3f73-2127a90d00e6@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Tue, 19 Oct 2021 20:36:43 +0200 Message-ID: <CAJkqNs0iK=5fyZ23=AJO4W-kwJm+EaQYbYx+w4nu8xtQirQoEQ@HIDDEN> Content-Type: multipart/mixed; boundary="00000000000013c2a205ceb8f23d" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --00000000000013c2a205ceb8f23d Content-Type: multipart/alternative; boundary="00000000000013c29f05ceb8f23b" --00000000000013c29f05ceb8f23b Content-Type: text/plain; charset="UTF-8" I found that for optimization purposes common cases in re_string_peek_byte are missed if pstr->mbs_allocated is true, thus skipping them also for case insensitive. My solution would be to return re_string_peek_byte also if pstr->icase is true. mbs_allocated is changed also depending on icase but I don't think we want to change it globally, so I think my patch should be fine and not affect optimization. Please check the attachment. If the patch is fine should I also send this to gnulib mailing list to have it submitted or is this one enough? Best regards, Tomasz Dziendzielski --00000000000013c29f05ceb8f23b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div>I found that for optimization purposes common ca= ses in re_string_peek_byte are missed if pstr->mbs_allocated is true, th= us skipping them also for case insensitive.<br><br></div>My solution would = be to return re_string_peek_byte also if pstr->icase is true. mbs_alloca= ted is changed also depending on icase but I don't think we want to cha= nge it globally, so I think my patch should be fine and not affect optimiza= tion.</div><div><br></div><div>Please check the attachment. If the patch is= fine should I also send this to gnulib mailing list to have it submitted o= r is this one enough?</div><div><br></div><div>Best regards,</div><div>Toma= sz Dziendzielski<br></div><br></div> --00000000000013c29f05ceb8f23b-- --00000000000013c2a205ceb8f23d Content-Type: text/x-patch; charset="US-ASCII"; name="0001-regex-Handle-common-easiest-cases-if-case-insensitiv.patch" Content-Disposition: attachment; filename="0001-regex-Handle-common-easiest-cases-if-case-insensitiv.patch" Content-Transfer-Encoding: base64 Content-ID: <f_kuyfh4e10> X-Attachment-Id: f_kuyfh4e10 RnJvbSA3M2JjMWUxYmFhZGZiOWJjNTFiNWU1YmQ1NmQ0NzRlNGZhNzIyNDkxIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUb21hc3ogRHppZW5kemllbHNraSA8dG9tYXN6LmR6aWVuZHpp ZWxza2lAZ21haWwuY29tPgpEYXRlOiBUdWUsIDE5IE9jdCAyMDIxIDIwOjI2OjI4ICswMjAwClN1 YmplY3Q6IFtQQVRDSF0gcmVnZXg6IEhhbmRsZSBjb21tb24gKGVhc2llc3QpIGNhc2VzIGlmIGNh c2UgaW5zZW5zaXRpdmUKCkdyZXAgY2FuIG1pc3Mgc29tZSBlYXN5IG1hdGNoZXMgaWYgcmVfc3Ry aW5nX3BlZWtfYnl0ZSBpcyBza2lwcGVkIGZvcgpjYXNlIGluc2Vuc2l0aXZlLgoKRml4ZXMgYnVn IDM5Njc4LgoKKiBsaWIvcmVnZXhfaW50ZXJuYWwuYyAocmVfc3RyaW5nX3BlZWtfYnl0ZV9jYXNl KTogUnVuCnJlX3N0cmluZ19wZWVrX2J5dGUgaWYgcHN0ci0+aWNhc2UKClNpZ25lZC1vZmYtYnk6 IFRvbWFzeiBEemllbmR6aWVsc2tpIDx0b21hc3ouZHppZW5kemllbHNraUBnbWFpbC5jb20+Ci0t LQogbGliL3JlZ2V4X2ludGVybmFsLmMgfCAyICstCiAxIGZpbGUgY2hhbmdlZCwgMSBpbnNlcnRp b24oKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9saWIvcmVnZXhfaW50ZXJuYWwuYyBi L2xpYi9yZWdleF9pbnRlcm5hbC5jCmluZGV4IGFlZmNmYTJmNTJlNjhjNmE2NDhkOGMxNDM0MDI3 ZWYyNWFlYzA4MmYuLmFlNDRhNzVlN2UwMjU1NDU1NzU3YTIzMzAwMjFjMDZmNWQ1YWRhODQgMTAw NjQ0Ci0tLSBhL2xpYi9yZWdleF9pbnRlcm5hbC5jCisrKyBiL2xpYi9yZWdleF9pbnRlcm5hbC5j CkBAIC04NDMsNyArODQzLDcgQEAgcmVfc3RyaW5nX3BlZWtfYnl0ZV9jYXNlIChjb25zdCByZV9z dHJpbmdfdCAqcHN0ciwgSWR4IGlkeCkKICAgSWR4IG9mZjsKIAogICAvKiBIYW5kbGUgdGhlIGNv bW1vbiAoZWFzaWVzdCkgY2FzZXMgZmlyc3QuICAqLwotICBpZiAoX19nbGliY19saWtlbHkgKCFw c3RyLT5tYnNfYWxsb2NhdGVkKSkKKyAgaWYgKF9fZ2xpYmNfbGlrZWx5ICghcHN0ci0+bWJzX2Fs bG9jYXRlZCB8fCBwc3RyLT5pY2FzZSkpCiAgICAgcmV0dXJuIHJlX3N0cmluZ19wZWVrX2J5dGUg KHBzdHIsIGlkeCk7CiAKICNpZmRlZiBSRV9FTkFCTEVfSTE4TgotLSAKMi4zMy4wCgo= --00000000000013c2a205ceb8f23d--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Paul Eggert <eggert@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Tue, 19 Oct 2021 23:24:02 +0000 Resent-Message-ID: <handler.39678.B39678.163468583430190 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163468583430190 (code B ref 39678); Tue, 19 Oct 2021 23:24:02 +0000 Received: (at 39678) by debbugs.gnu.org; 19 Oct 2021 23:23:54 +0000 Received: from localhost ([127.0.0.1]:52254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mcySY-0007qs-Fh for submit <at> debbugs.gnu.org; Tue, 19 Oct 2021 19:23:54 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mcySW-0007qa-Bz for 39678 <at> debbugs.gnu.org; Tue, 19 Oct 2021 19:23:53 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0CC48160083; Tue, 19 Oct 2021 16:23:46 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id wdfWeW0Di8KC; Tue, 19 Oct 2021 16:23:45 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5B8BF16008A; Tue, 19 Oct 2021 16:23:45 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id DIrE9vM0NcJz; Tue, 19 Oct 2021 16:23:45 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3E541160083; Tue, 19 Oct 2021 16:23:45 -0700 (PDT) Message-ID: <cf1e2c64-3995-b2ca-8734-dbcf9e240192@HIDDEN> Date: Tue, 19 Oct 2021 16:23:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Content-Language: en-US References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> <ee59f460-2783-0f08-3f73-2127a90d00e6@HIDDEN> <CAJkqNs0iK=5fyZ23=AJO4W-kwJm+EaQYbYx+w4nu8xtQirQoEQ@HIDDEN> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <CAJkqNs0iK=5fyZ23=AJO4W-kwJm+EaQYbYx+w4nu8xtQirQoEQ@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.4 (--) 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: -3.4 (---) On 10/19/21 11:36, Tomasz Dziendzielski wrote: > I found that for optimization purposes common cases in re_string_peek_byte > are missed if pstr->mbs_allocated is true, thus skipping them also for case > insensitive. Unfortunately I've lost context here. Is this patch being proposed to improve performance, or to fix a bug? I don't see how the patch preserves correctness: if pstr->icase is true, surely in general we need to look at the translated string, not the original.
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Wed, 20 Oct 2021 01:11:02 +0000 Resent-Message-ID: <handler.39678.B39678.163469224625395 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert <eggert@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163469224625395 (code B ref 39678); Wed, 20 Oct 2021 01:11:02 +0000 Received: (at 39678) by debbugs.gnu.org; 20 Oct 2021 01:10:46 +0000 Received: from localhost ([127.0.0.1]:52328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1md07x-0006bW-HC for submit <at> debbugs.gnu.org; Tue, 19 Oct 2021 21:10:45 -0400 Received: from mail-vk1-f175.google.com ([209.85.221.175]:34539) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1md07v-0006bI-43 for 39678 <at> debbugs.gnu.org; Tue, 19 Oct 2021 21:10:43 -0400 Received: by mail-vk1-f175.google.com with SMTP id bc10so4352574vkb.1 for <39678 <at> debbugs.gnu.org>; Tue, 19 Oct 2021 18:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mb2S/bCF4iT8SiSaFMJh8cV9mdtAvhEbn7TyDUOUF9I=; b=hhsPhN2j+IZ/8+oyrq1xuzxMhl8ieWegD8SOE1N9Xy2BrmPjLvvTviHktG9VoPWeSO 72uW4KYkqGN5xLVfHiHoV8cqg+BG9nWxPYzM8c0cnROVYcf+ETrwxKedAnOl6NE6GM2u lXAE+mTfYuSy7swHdk5T3BtNWHu4dzpoULgV7K0e3E01Nwes+h5H3PddcOSGz1enVa6f trscu0W9hbaR5cSLU0gzqFuXGXNIjPFvWHoeeqJZSdn9fHGF+/E2J1ZgHbbcGFvnptjE eYe02R5KI+jXJ7qfJuRz4DBc6aM7XtL40n5Hi6DI86HJghvecHHeteEggPlIu6Y7XgOs 3d5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mb2S/bCF4iT8SiSaFMJh8cV9mdtAvhEbn7TyDUOUF9I=; b=Yv6/9HiL3FwIY+a3OGv+GYWD54x5inm1cj8EFcnAHRi8+yqn6mTABbmZxhc5gFOr2d 1zPThP1jfJZYzz4gxor8Aywsc48ZERKkq6/DhqEqLfforeje4g2Ig0PBYb+VwdPCzcNM LoAaybGiNZI1p93J4iMm19bf6m9yQoP8zVWkzi11papfbIYrkcsrh3xJkWGJ/H1Sbu5L qL1Z6Ie+/6eOoYGM5SyKlJnGe4DYoZ0bpfymCDxvs7uI6KBCR7ufEC3CGSyIoO0ZIfgt Kb5HjeLdhrvaJFL46M2rxAFhYyxzN/aWGGIa+dehLw2q2dNeDe6T02oADKSh6lZlg8KD tlwA== X-Gm-Message-State: AOAM533Bg4uyncBi8p27r/lzHGxLkVjWbwWpscxXs2dCVwojcL29fzgy ztydX0sCzA+q/SybISFSfPppXzDg3TrATo72pejrphi4OHaYuw== X-Google-Smtp-Source: ABdhPJzPi941712N5Z1zbjTXlpvlhnEsgR4h/imuRAipqljzYWXm9hFC7H/SO+o4SL4bkL/gfM0r94jYMVBobXOCSTc= X-Received: by 2002:a05:6122:550:: with SMTP id y16mr6001295vko.18.1634692237583; Tue, 19 Oct 2021 18:10:37 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> <ee59f460-2783-0f08-3f73-2127a90d00e6@HIDDEN> <CAJkqNs0iK=5fyZ23=AJO4W-kwJm+EaQYbYx+w4nu8xtQirQoEQ@HIDDEN> <cf1e2c64-3995-b2ca-8734-dbcf9e240192@HIDDEN> In-Reply-To: <cf1e2c64-3995-b2ca-8734-dbcf9e240192@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Wed, 20 Oct 2021 03:10:25 +0200 Message-ID: <CAJkqNs3k3MPyvcMCuy3W1Yi8u+ehHp3XCEjdFoiUDvYW18m9wQ@HIDDEN> Content-Type: multipart/alternative; boundary="00000000000023670105cebe727b" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --00000000000023670105cebe727b Content-Type: text/plain; charset="UTF-8" >> I found that for optimization purposes common cases in re_string_peek_byte >> are missed if pstr->mbs_allocated is true, thus skipping them also for case >> insensitive. >Unfortunately I've lost context here. Is this patch being proposed to >improve performance, or to fix a bug? >I don't see how the patch preserves correctness: if pstr->icase is true, >surely in general we need to look at the translated string, not the >original. It's to fix the bug. Without the patch if we use icase this re_string_peek_byte was not executed and as a consequence match is not found. If we apply the patch grep is able to match the '\a' correctly. The patch has nothing to do with improving performance, if was just an additional comment from my side that the fix should not affect the performance (in my opinion). Sorry for confusion. Best regards, Tomasz Dziendzielski --00000000000023670105cebe727b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">>> I found that for optimization purposes common ca= ses in re_string_peek_byte<br>>> are missed if pstr->mbs_allocated= is true, thus skipping them also for case<br>>> insensitive.<br><br>= >Unfortunately I've lost context here. Is this patch being proposed = to<br>>improve performance, or to fix a bug?<br><br>>I don't see = how the patch preserves correctness: if pstr->icase is true,<br>>sure= ly in general we need to look at the translated string, not the<br>>orig= inal.<div dir=3D"auto"><br></div><div dir=3D"auto">It's to fix the bug.= Without the patch if we use icase this re_string_peek_byte was not execute= d and as a consequence match is not found.</div><div dir=3D"auto">If we app= ly the patch grep is able to match the '\a' correctly. The patch ha= s nothing to do with improving performance, if was just an additional comme= nt from my side that the fix should not affect the performance (in my opini= on). Sorry for confusion.</div><div dir=3D"auto"><br></div><div dir=3D"auto= ">Best regards,</div><div dir=3D"auto">Tomasz Dziendzielski</div></div> --00000000000023670105cebe727b--
X-Loop: help-debbugs@HIDDEN Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches Resent-From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Tue, 02 Nov 2021 19:26:01 +0000 Resent-Message-ID: <handler.39678.B39678.163588111027317 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 39678 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Paul Eggert <eggert@HIDDEN> Cc: 39678 <at> debbugs.gnu.org Received: via spool by 39678-submit <at> debbugs.gnu.org id=B39678.163588111027317 (code B ref 39678); Tue, 02 Nov 2021 19:26:01 +0000 Received: (at 39678) by debbugs.gnu.org; 2 Nov 2021 19:25:10 +0000 Received: from localhost ([127.0.0.1]:38119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mhzPC-00076W-E5 for submit <at> debbugs.gnu.org; Tue, 02 Nov 2021 15:25:10 -0400 Received: from mail-ua1-f43.google.com ([209.85.222.43]:47020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tomasz.dziendzielski@HIDDEN>) id 1mhzPA-00076I-UU for 39678 <at> debbugs.gnu.org; Tue, 02 Nov 2021 15:25:09 -0400 Received: by mail-ua1-f43.google.com with SMTP id az37so74818uab.13 for <39678 <at> debbugs.gnu.org>; Tue, 02 Nov 2021 12:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6xXlErwr1PV3yavecxAuhosQb6h91jWDQCLe2LUI5p0=; b=USgrann5TjegXDJa6N8iSdHhA9sNiE+SRFcHOidiX9lRXVPi8QoA5pb2F2vMNTetRZ ardPTAHedS2/B2GRF8b4ai9/KHXmb6NHv0hOB7ejcgKk6rZuLFVr89jUvDuNHi/iBeTr TSx5Aqabrb6vujyOhmGuCH9UtOJfd4cjLFZo8yaBZYPdFIUdD5is/7ERYc/2iHErAvGy KsFIcJNHth+Yj+kxjvu6id42QzwAGoZIyVbVAKFco7Yo0CyehtLzesHQuJFqOxDo5Iyd 2ZzcHB4zK8PBdS/zXtUMlNY7+Ra+8R9ZNY9YeZFpoiClZndH8GtJKf3Q39y7UjxMQUVu neDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6xXlErwr1PV3yavecxAuhosQb6h91jWDQCLe2LUI5p0=; b=sxkf9f5r2/vAGC2cvLLmtMI6CNSKBN+uofUa2GEi6/XcoLfSrqOWTihGUVl3gn3voh BmHN1BU9n5pG4r+uvnoWfTEg/a6l3LBuBZEh1tE7kCGFfeOoctEmixMD+MtIWGKCx5gD T4Z7B59C778WGO+79IvIk82eJLw7rRaYc1OU/CmseYfqD4jGlUoGK9JRCK1gjSvWfGkV YewHX6RwUwo/Gs0085os5Bs3kbltf0Sw5t+rMnM2EW/cccAcM9Mr7hq+Vfp30GR5Jdza F1WAXHMb6/Mv/sDEY/2zEPpKG6gi58MS5Vvv+btTnGMV42suRHYlzvsWlLX80w9EiTJR KZnQ== X-Gm-Message-State: AOAM530Cy5iPDAbSpFGbae9+1ssav9/PdEALsBPWYQdBZ5UQgHmgU+oo ObQBHUIoBWQGc6SoGc3a91b3RU9nLbadtt9L4TKBoCazU5qq/jRJ X-Google-Smtp-Source: ABdhPJzXw4ohlcAlSPjMLTdH1cWfGR/TTuVNH/f9Pf5qEqHU1T2tx98FvUlwogqQV9RodY963zZTiVDyyCd2LTn+T60= X-Received: by 2002:a05:6102:105a:: with SMTP id h26mr8896645vsq.51.1635881103271; Tue, 02 Nov 2021 12:25:03 -0700 (PDT) MIME-Version: 1.0 References: <CAJkqNs0mDh8PNsZYtfCvtDoDQSRMoJhVT07wCsaLNhJGfBUwAg@HIDDEN> <CAJkqNs3f-J1pdcUKeTHOv4bpCR4hh2GjyLiwWi0MPPxChEjeZA@HIDDEN> <a0ab821b-8f58-9f79-dc2d-61f512d9532c@HIDDEN> <CAJkqNs0PEo5pKkE2mhL=uMsdHq5RrGL-fWBC94hoyWxnLD+=Xw@HIDDEN> <ee59f460-2783-0f08-3f73-2127a90d00e6@HIDDEN> <CAJkqNs0iK=5fyZ23=AJO4W-kwJm+EaQYbYx+w4nu8xtQirQoEQ@HIDDEN> <cf1e2c64-3995-b2ca-8734-dbcf9e240192@HIDDEN> <CAJkqNs3k3MPyvcMCuy3W1Yi8u+ehHp3XCEjdFoiUDvYW18m9wQ@HIDDEN> In-Reply-To: <CAJkqNs3k3MPyvcMCuy3W1Yi8u+ehHp3XCEjdFoiUDvYW18m9wQ@HIDDEN> From: Tomasz Dziendzielski <tomasz.dziendzielski@HIDDEN> Date: Tue, 2 Nov 2021 20:24:51 +0100 Message-ID: <CAJkqNs0OOFbNq2rhXL+o0o2mAWGh7ECL95iB7C8e0tiPzXGSnA@HIDDEN> Content-Type: multipart/alternative; boundary="0000000000000e29e705cfd3407b" X-Spam-Score: 0.0 (/) 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: -1.0 (-) --0000000000000e29e705cfd3407b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, so is my patch correct? Without my patch re_string_peek_byte() is not executed - and this is the function that is executed (and where the match is found) when "--ignore-case" is not enabled. With my patch grep is able to match the '\a' while still preserving the correctness for other cases. For sure some tests would be helpful but from what I checked my patch is not breaking anything else while adding the correct match for '\a' case. If you still think the patch is wrong, could you please point me in the right direction? Maybe you could point me where it's not preserving correctness. Best regards, Tomasz Dziendzielski =C5=9Br., 20 pa=C5=BA 2021 o 03:10 Tomasz Dziendzielski < tomasz.dziendzielski@HIDDEN> napisa=C5=82(a): > >> I found that for optimization purposes common cases in > re_string_peek_byte > >> are missed if pstr->mbs_allocated is true, thus skipping them also for > case > >> insensitive. > > >Unfortunately I've lost context here. Is this patch being proposed to > >improve performance, or to fix a bug? > > >I don't see how the patch preserves correctness: if pstr->icase is true, > >surely in general we need to look at the translated string, not the > >original. > > It's to fix the bug. Without the patch if we use icase this > re_string_peek_byte was not executed and as a consequence match is not > found. > If we apply the patch grep is able to match the '\a' correctly. The patch > has nothing to do with improving performance, if was just an additional > comment from my side that the fix should not affect the performance (in m= y > opinion). Sorry for confusion. > > Best regards, > Tomasz Dziendzielski > --0000000000000e29e705cfd3407b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Hi,<br></div><div>so is my patch correct? Without my = patch re_string_peek_byte() is not executed - and this is the function that= is executed (and where the match is found) when "--ignore-case" = is not enabled. With my patch grep is able to match the '\a' while = still preserving the correctness for other cases. For sure some tests would= be helpful but from what I checked my patch is not breaking anything else = while adding the correct match for '\a' case.<br></div><div><br></d= iv><div>If you still think the patch is wrong, could you please point me i= n the right direction? Maybe you could point me where it's not preservi= ng correctness.</div><div><br></div><div>Best regards,</div><div>Tomasz Dzi= endzielski<br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" c= lass=3D"gmail_attr">=C5=9Br., 20 pa=C5=BA 2021 o 03:10=C2=A0Tomasz Dziendzi= elski <<a href=3D"mailto:tomasz.dziendzielski@HIDDEN">tomasz.dziendzi= elski@HIDDEN</a>> napisa=C5=82(a):<br></div><blockquote class=3D"gmai= l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20= 4,204);padding-left:1ex"><div dir=3D"auto">>> I found that for optimi= zation purposes common cases in re_string_peek_byte<br>>> are missed = if pstr->mbs_allocated is true, thus skipping them also for case<br>>= > insensitive.<br><br>>Unfortunately I've lost context here. Is t= his patch being proposed to<br>>improve performance, or to fix a bug?<br= ><br>>I don't see how the patch preserves correctness: if pstr->i= case is true,<br>>surely in general we need to look at the translated st= ring, not the<br>>original.<div dir=3D"auto"><br></div><div dir=3D"auto"= >It's to fix the bug. Without the patch if we use icase this re_string_= peek_byte was not executed and as a consequence match is not found.</div><d= iv dir=3D"auto">If we apply the patch grep is able to match the '\a'= ; correctly. The patch has nothing to do with improving performance, if was= just an additional comment from my side that the fix should not affect the= performance (in my opinion). Sorry for confusion.</div><div dir=3D"auto"><= br></div><div dir=3D"auto">Best regards,</div><div dir=3D"auto">Tomasz Dzie= ndzielski</div></div> </blockquote></div> --0000000000000e29e705cfd3407b--
Received: (at control) by debbugs.gnu.org; 24 Nov 2021 02:51:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 23 21:51:49 2021 Received: from localhost ([127.0.0.1]:52657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1mpiNx-0002nD-I3 for submit <at> debbugs.gnu.org; Tue, 23 Nov 2021 21:51:49 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:59462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1mpiNu-0002mw-Gi for control <at> debbugs.gnu.org; Tue, 23 Nov 2021 21:51:47 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 141971600BC for <control <at> debbugs.gnu.org>; Tue, 23 Nov 2021 18:51:41 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id hx6hSX0lQO07 for <control <at> debbugs.gnu.org>; Tue, 23 Nov 2021 18:51:40 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 76CB41600D3 for <control <at> debbugs.gnu.org>; Tue, 23 Nov 2021 18:51:40 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id o-YwJATAgPit for <control <at> debbugs.gnu.org>; Tue, 23 Nov 2021 18:51:40 -0800 (PST) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 4775D1600BC for <control <at> debbugs.gnu.org>; Tue, 23 Nov 2021 18:51:40 -0800 (PST) Message-ID: <b26198b9-df76-ab71-b8c8-d9adfd47b5ca@HIDDEN> Date: Tue, 23 Nov 2021 18:51:39 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Content-Language: en-US To: GNU bug control <control <at> debbugs.gnu.org> From: Paul Eggert <eggert@HIDDEN> Subject: more grep bug merging Organization: UCLA Computer Science Department Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control 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: -3.3 (---) merge 39678 51257
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.