From unknown Wed Jun 18 00:26:25 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#39678 <39678@debbugs.gnu.org> To: bug#39678 <39678@debbugs.gnu.org> Subject: Status: 'grep --ignore-case --color' does not always color the matches Reply-To: bug#39678 <39678@debbugs.gnu.org> Date: Wed, 18 Jun 2025 07:26:25 +0000 retitle 39678 'grep --ignore-case --color' does not always color the matches reassign 39678 grep submitter 39678 Benno Schulenberg severity 39678 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 19 10:27:30 2020 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 ) id 1j4RG5-00049Q-JQ for submit@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 ) id 1j4MeD-0007Xw-GT for submit@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 ) id 1j4MeC-0003pz-13 for bug-grep@gnu.org; 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 ) id 1j4Me9-0008Jq-Lj for bug-grep@gnu.org; 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 ) id 1j4Me9-0008E3-6P for bug-grep@gnu.org; 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@feedback.cloudmark.com 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) To: bug-grep@gnu.org From: Benno Schulenberg Subject: 'grep --ignore-case --color' does not always color the matches Message-ID: <1db9fcd0-4b24-d260-35d1-80a7f797f76b@telfort.nl> 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-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 19 Feb 2020 10:27:28 -0500 Cc: bpaddis@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 17 23:59:13 2021 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 ) id 1mcJnp-0008SW-W2 for submit@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 ) id 1mcCva-0005hP-Na for submit@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 ) id 1mcCva-0001Q9-G7 for bug-grep@gnu.org; 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 ) id 1mcCvY-0008NW-Aa for bug-grep@gnu.org; Sun, 17 Oct 2021 16:38:41 -0400 Received: by mail-ua1-x931.google.com with SMTP id h4so689184uaw.1 for ; 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 Date: Sun, 17 Oct 2021 22:38:27 +0200 Message-ID: Subject: bug#39678: 'grep --ignore-case --color' does not always color the matches To: bug-grep@gnu.org, bensberg@telfort.nl Content-Type: multipart/mixed; boundary="000000000000bb81d205ce926900" Received-SPF: pass client-ip=2607:f8b0:4864:20::931; envelope-from=tomasz.dziendzielski@gmail.com; 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-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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"
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-- --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: X-Attachment-Id: f_kuvokisl0 RnJvbSAwNzgwNTI1OWI5YmYzZTE2Nzg0N2ExY2Y1MzA4YjZjNTQwMThiNzA5IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBUb21hc3ogRHppZW5kemllbHNraSA8dG9tYXN6LmR6aWVuZHpp ZWxza2lAZ21haWwuY29tPgpEYXRlOiBTdW4sIDE3IE9jdCAyMDIxIDIxOjQ3OjI4ICswMjAwClN1 YmplY3Q6IFtQQVRDSF0gZ3JlcDogRG9uJ3QgcHJpbnQgbGluZSBpZiBtYXRjaGVyIHJldHVybmVk IG5vdGhpbmcKCkl0IGNhbiBoYXBwZW4gdGhhdCByZV9zZWFyY2ggaW4gRUdleGVjdXRlIGZhaWxz IGFuZCByZXR1cm5zIG5vdGhpbmcgc28KZm9yIGxvb3AgaW4gcHJpbnRfbGluZV9taWRkbGUgcnVu cyB6ZXJvIHRpbWVzIGJ1dCBzdGlsbCBzdGlsbCByZXR1cm5zCnRyYXNoIHVuZGVyIGBjdXJgIHZh cmlhYmxlLCBzbyBncmVwIHRo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nNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQgPSBOVUxMOwotICBj aGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9IGJlZzsKICAgICAgICAo Y3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9saW5lX21pZGRsZSAoY2hhciAq YmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBlbHNlIGlmIChtaWQpCiAgICAgY3Vy ID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisgICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0 dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --000000000000bb81d205ce926900-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 17 23:59:29 2021 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 ) id 1mcJnu-0008Sr-CF for submit@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 ) id 1mcDqk-0007It-Dj for 39678@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@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 Date: Sun, 17 Oct 2021 23:37:30 +0200 Message-ID: Subject: #39678: grep --ignore-case --color does not always color the matches To: bensberg@telfort.nl, bug-grep@gnu.org Content-Type: multipart/mixed; boundary="000000000000e79a3705ce933c51" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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"
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-- --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: X-Attachment-Id: f_kuvr09bg0 RnJvbSAwNzgwNTI1OWI5YmYzZTE2Nzg0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WduZWQtb2ZmLWJ5OiBUb21hc3ogRHppZW5kemllbHNraSA8dG9t YXN6LmR6aWVuZHppZWxza2lAZ21haWwuY29tPgotLS0KIHNyYy9ncmVwLmMgfCA0ICsrKy0KIDEg ZmlsZSBjaGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQg YS9zcmMvZ3JlcC5jIGIvc3JjL2dyZXAuYwppbmRleCBhNTUxOTRjZjFhYTkwNzJlY2MzN2ExMzU3 NGJjNTg4MTY3ZWU1ZDk0Li5iMzcyZTM0MTVjY2JmNmY4OTYwMzlhNmQ3MmJkNmMzNDk4ZDhjMjY5 IDEwMDY0NAotLS0gYS9zcmMvZ3JlcC5jCisrKyBiL3NyYy9ncmVwLmMKQEAgLTEyMTMsNyArMTIx Myw3IEBAIHByaW50X2xpbmVfbWlkZGxlIChjaGFyICpiZWcsIGNoYXIgKmxpbSwKICAgcHRyZGlm Zl90IG1hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQgPSBOVUxMOwotICBj aGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9IGJlZzsKICAgICAgICAo Y3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9saW5lX21pZGRsZSAoY2hhciAq YmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBlbHNlIGlmIChtaWQpCiAgICAgY3Vy ID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisgICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0 dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --000000000000e79a3705ce933c51-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 17 23:59:42 2021 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 ) id 1mcJoI-0008TW-2s for submit@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 ) id 1mcEF2-00080H-QB for 39678@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@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 Date: Mon, 18 Oct 2021 00:02:36 +0200 Message-ID: Subject: grep --ignore-case --color does not always color the matches To: bug-grep@gnu.org Content-Type: multipart/mixed; boundary="000000000000aecb8205ce93967e" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
Hello,
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.

I'= m sending the patch with the fix in the attachment.

Best re= gards,
Tomasz Dziendzielski
--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 cmlhYmxlLCBzby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hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQgPSBOVUxMOwotICBj aGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9IGJlZzsKICAgICAgICAo Y3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9saW5lX21pZGRsZSAoY2hhciAq YmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBlbHNlIGlmIChtaWQpCiAgICAgY3Vy ID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisgICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0 dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --000000000000aecb8205ce93967e-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 17 23:59:43 2021 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 ) id 1mcJoM-0008Th-NS for submit@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 ) id 1mcER8-0008Lt-DY for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Mon, 18 Oct 2021 00:15:05 +0200 Message-ID: Subject: 'grep --ignore-case --color' does not always color the matches To: 39678@debbugs.gnu.org Content-Type: multipart/mixed; boundary="0000000000005ede9b05ce93c32a" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
=
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 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.

<= /div>
I'm sending the patch with the fix in the attachment.

Best regards,
Tomasz Dziendzielski
--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-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GNoIG5vdCBmb3VuZCBhbmQgZm9yCmxv b3Agbm90IGV4ZWN1dGVkCgpTaWduZWQtb2ZmLWJ5OiBUb21hc3ogRHppZW5kemllbHNraSA8dG9t YXN6LmR6aWVuZHppZWxza2lAZ21haWwuY29tPgotLS0KIHNyYy9ncmVwLmMgfCA0ICsrKy0KIDEg ZmlsZSBjaGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRpZmYgLS1naXQg YS9zcmMvZ3JlcC5jIGIvc3JjL2dyZXAuYwppbmRleCBhNTUxOTRjZjFhYTkwNzJlY2MzN2ExMzU3 NGJjNTg4MTY3ZWU1ZDk0Li5iMzcyZTM0MTVjY2JmNmY4OTYwMzlhNmQ3MmJkNmMzNDk4ZDhjMjY5 IDEwMDY0NAotLS0gYS9zcmMvZ3JlcC5jCisrKyBiL3NyYy9ncmVwLmMKQEAgLTEyMTMsNyArMTIx Myw3IEBAIHByaW50X2xpbmVfbWlkZGxlIChjaGFyICpiZWcsIGNoYXIgKmxpbSwKICAgcHRyZGlm Zl90IG1hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQgPSBOVUxMOwotICBj aGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9IGJlZzsKICAgICAgICAo Y3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9saW5lX21pZGRsZSAoY2hhciAq YmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBlbHNlIGlmIChtaWQpCiAgICAgY3Vy ID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisgICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0 dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --0000000000005ede9b05ce93c32a-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 17 23:59:44 2021 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 ) id 1mcJoO-0008Tp-0S for submit@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 ) id 1mcEcD-0000FQ-N8 for 39678@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@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: Date: Mon, 18 Oct 2021 00:26:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Content-Language: en-US To: bug-grep@gnu.org From: Tomasz Dziendzielski Subject: grep --ignore-case --color does not always color the matches X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 X-Mailman-Approved-At: Sun, 17 Oct 2021 23:59:07 -0400 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
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-- --------------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 aWVuZHppZWxza2lAZ21haWwuY29tPgpEYXRlOiBTdW4sIDE3IE9jdCAy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gZGVsZXRpb24oLSkKCmRpZmYgLS1naXQgYS9z cmMvZ3JlcC5jIGIvc3JjL2dyZXAuYwppbmRleCBhNTUxOTRjZjFhYTkwNzJlY2MzN2ExMzU3 NGJjNTg4MTY3ZWU1ZDk0Li5iMzcyZTM0MTVjY2JmNmY4OTYwMzlhNmQ3MmJkNmMzNDk4ZDhj MjY5IDEwMDY0NAotLS0gYS9zcmMvZ3JlcC5jCisrKyBiL3NyYy9ncmVwLmMKQEAgLTEyMTMs NyArMTIxMyw3IEBAIHByaW50X2xpbmVfbWlkZGxlIChjaGFyICpiZWcsIGNoYXIgKmxpbSwK ICAgcHRyZGlmZl90IG1hdGNoX29mZnNldDsKICAgY2hhciAqY3VyOwogICBjaGFyICptaWQg PSBOVUxMOwotICBjaGFyICpiOworICBjaGFyICpiID0gTlVMTDsKIAogICBmb3IgKGN1ciA9 IGJlZzsKICAgICAgICAoY3VyIDwgbGltCkBAIC0xMjY5LDYgKzEyNjksOCBAQCBwcmludF9s aW5lX21pZGRsZSAoY2hhciAqYmVnLCBjaGFyICpsaW0sCiAgICAgY3VyID0gbGltOwogICBl bHNlIGlmIChtaWQpCiAgICAgY3VyID0gbWlkOworICBlbHNlIGlmIChiID09IE5VTEwpCisg ICAgcmV0dXJuIE5VTEw7CiAKICAgcmV0dXJuIGN1cjsKIH0KLS0gCjIuMzMuMAoK --------------77RGBoYuUJoxVSEgbyGMIsAF-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 18 00:08:47 2021 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 ) id 1mcJx8-0000K9-79 for submit@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 ) id 1mcJx0-0000Jp-1s for 39678@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: 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 Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches Content-Language: en-US To: Tomasz Dziendzielski References: From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 18 00:45:10 2021 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 ) id 1mcKWM-0001CW-EP for submit@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 ) id 1mcKWH-0001Bg-7y for 39678@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@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@gmail.com> <0b8032a0-df81-fadf-d532-6d2246c9cff5@cs.ucla.edu> In-Reply-To: From: Tomasz Dziendzielski Date: Mon, 18 Oct 2021 06:44:48 +0200 Message-ID: Subject: Fwd: 'grep --ignore-case --color' does not always color the matches To: 39678@debbugs.gnu.org Content-Type: multipart/alternative; boundary="00000000000017237505ce993577" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
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 s= ent correctly on my side.

>EGexecute should return a = match, though,
>right? The pattern '\a' matches
>the data 'a&#= 39;. So the bug is in EGexecute >somewhere, not in its caller.
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.
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:
>>>re.search("\j","= ;j", re.IGNORECASE)
re.erro= r: bad escape \j at position 0
D= ue to that I think grep should also ignore the non-maching/bad character in= stead of printing them.

=
Best regards,
= Tomasz Dziendzielski
--00000000000017237505ce993577-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 18 00:51:36 2021 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 ) id 1mcKca-0001Nb-7O for submit@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 ) id 1mcKcV-0001NL-2g for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Mon, 18 Oct 2021 06:53:01 +0200 Message-ID: Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches To: Paul Eggert Content-Type: multipart/alternative; boundary="00000000000017f44c05ce994c27" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 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
>EGexecute should return a match, though,=
>right? The pat= tern '\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=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.
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:
>>&g= t;re.search("\j","j", re.IGNORECASE)
<= font face=3D"sans-serif">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 Dziendziel= ski

pon., 18 pa=C5=BA 2021 o 06:08=C2=A0Paul Eggert &= lt;eggert@cs.ucla.edu> 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 re= turn a match.

Gexecute should return a match, though, right? This is because the
pattern '\a' matches the data 'a'. So it sounds like the bu= g is in
EGexecute somewhere, not in its caller.
--00000000000017f44c05ce994c27-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 18 01:11:02 2021 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 ) id 1mcKvO-0001vb-1S for submit@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 ) id 1mcKvM-0001v8-Vx for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Mon, 18 Oct 2021 07:10:44 +0200 Message-ID: Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches To: Paul Eggert Content-Type: multipart/alternative; boundary="000000000000d540a405ce9991bf" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
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?

Best regards,
Tomasz= Dziendzielski
--000000000000d540a405ce9991bf-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 18 09:37:36 2021 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 ) id 1mcSpb-0000ow-Lw for submit@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 ) id 1mcSpZ-0000oi-1Y for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Mon, 18 Oct 2021 15:39:03 +0200 Message-ID: Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches To: Paul Eggert Content-Type: multipart/alternative; boundary="00000000000055323e05cea0a59b" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 ( '\\' ) 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@gmail.com> 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
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 o= f an ordinary character preceded by an unescaped <backslash> ( &#= 39;\\' ) is undefined, except for: [...]"
which means that escaping ordinary characters (l= ike \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 printe= d. That would make my patch correct.


Looking fo= rward to feedback.

Best regards,
To= masz Dziendzielski

pon., 18 pa=C5=BA 2021 o 07:10=C2=A0Tomasz Dz= iendzielski <tomasz.dz= iendzielski@gmail.com> 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 regar= ds,
Tomasz Dziendzielski
--00000000000055323e05cea0a59b-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 18 11:40:10 2021 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 ) id 1mcUkE-0006UL-N3 for submit@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 ) id 1mcUkA-0006Tb-6G for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Mon, 18 Oct 2021 17:39:49 +0200 Message-ID: Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches To: Paul Eggert Content-Type: multipart/alternative; boundary="00000000000096f94805cea25b6f" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
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:
$ echo "a"= ; | grep -E "{1,3}"
$ echo "a" | grep -i &quo= t;\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 --c= olor was not passed. I'll try to work on that.

Best r= egards,
Tomasz Dziendzielski
--00000000000096f94805cea25b6f-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 18 12:11:54 2021 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 ) id 1mcVEw-00017l-1t for submit@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 ) id 1mcVEt-00017Y-GJ for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Mon, 18 Oct 2021 18:11:34 +0200 Message-ID: Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches To: Paul Eggert Content-Type: multipart/alternative; boundary="0000000000002f877b05cea2cdc4" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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@gmail.com> 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
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.

Best regards,
Tomasz Dziendziel= ski

pon., 18 pa=C5=BA 2021, 17:39 u=C5=BCytkownik Tomasz Dziendzielski= <tomasz.dziendzielski= @gmail.com> napisa=C5=82:
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:
$ echo "a" = | grep -E "{1,3}"
$ echo "a" | grep -i "= \a"
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.

Best reg= ards,
Tomasz Dziendzielski
--0000000000002f877b05cea2cdc4-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 18 12:59:31 2021 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 ) id 1mcVz1-0004UD-Gp for submit@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 ) id 1mcVyy-0004Tv-7X for 39678@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: 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 Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches Content-Language: en-US To: Tomasz Dziendzielski References: From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 19 14:37:02 2021 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 ) id 1mctyw-0002mM-2V for submit@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 ) id 1mctyt-0002m4-Pm for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Tue, 19 Oct 2021 20:36:43 +0200 Message-ID: Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches To: Paul Eggert Content-Type: multipart/mixed; boundary="00000000000013c2a205ceb8f23d" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
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.

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.

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?

Best regards,
Toma= sz Dziendzielski

--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: 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-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 19 19:23:54 2021 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 ) id 1mcySY-0007qs-Fh for submit@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 ) id 1mcySW-0007qa-Bz for 39678@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: 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 Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches Content-Language: en-US To: Tomasz Dziendzielski References: From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 19 21:10:46 2021 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 ) id 1md07x-0006bW-HC for submit@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 ) id 1md07v-0006bI-43 for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Wed, 20 Oct 2021 03:10:25 +0200 Message-ID: Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches To: Paul Eggert Content-Type: multipart/alternative; boundary="00000000000023670105cebe727b" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
>> I found that for optimization purposes common ca= ses 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,
>sure= ly in general we need to look at the translated string, not the
>orig= inal.

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.
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.

Best regards,
Tomasz Dziendzielski
--00000000000023670105cebe727b-- From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 02 15:25:10 2021 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 ) id 1mhzPC-00076W-E5 for submit@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 ) id 1mhzPA-00076I-UU for 39678@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@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: In-Reply-To: From: Tomasz Dziendzielski Date: Tue, 2 Nov 2021 20:24:51 +0100 Message-ID: Subject: Re: bug#39678: 'grep --ignore-case --color' does not always color the matches To: Paul Eggert Content-Type: multipart/alternative; boundary="0000000000000e29e705cfd3407b" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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@gmail.com> 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
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 i= n the right direction? Maybe you could point me where it's not preservi= ng correctness.

Best regards,
Tomasz Dzi= endzielski

=C5=9Br., 20 pa=C5=BA 2021 o 03:10=C2=A0Tomasz Dziendzi= elski <tomasz.dziendzi= elski@gmail.com> napisa=C5=82(a):
>> I found that for optimi= zation 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 t= his patch being proposed to
>improve performance, or to fix a bug?
>I don't see how the patch preserves correctness: if pstr->i= case is true,
>surely in general we need to look at the translated st= ring, 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.
<= br>
Best regards,
Tomasz Dzie= ndzielski
--0000000000000e29e705cfd3407b-- From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 23 21:51:49 2021 Received: (at control) by debbugs.gnu.org; 24 Nov 2021 02:51:49 +0000 Received: from localhost ([127.0.0.1]:52657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mpiNx-0002nD-I3 for submit@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 ) id 1mpiNu-0002mw-Gi for control@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 ; 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 ; 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 ; 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 ; 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 ; Tue, 23 Nov 2021 18:51:40 -0800 (PST) Message-ID: 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 From: Paul Eggert 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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) merge 39678 51257 From debbugs-submit-bounces@debbugs.gnu.org Sat May 21 06:05:47 2022 Received: (at 39678) by debbugs.gnu.org; 21 May 2022 10:05:47 +0000 Received: from localhost ([127.0.0.1]:40724 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsLzX-00022F-B9 for submit@debbugs.gnu.org; Sat, 21 May 2022 06:05:47 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41282) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsLzV-000223-C5 for 39678@debbugs.gnu.org; Sat, 21 May 2022 06:05:46 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EB620160126; Sat, 21 May 2022 03:05:39 -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 CGGITKrH-IXV; Sat, 21 May 2022 03:05:39 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0675616013F; Sat, 21 May 2022 03:05:39 -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 bEjvYTCfcHWa; Sat, 21 May 2022 03:05:38 -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 7326C160126; Sat, 21 May 2022 03:05:38 -0700 (PDT) Message-ID: <9b607770-3676-60fb-17a4-96d025862a3c@cs.ucla.edu> Date: Sat, 21 May 2022 03:05:38 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Content-Language: en-US To: 39678@debbugs.gnu.org From: Paul Eggert Organization: UCLA Computer Science Department Subject: POSIXLY_CORRECT removal, and oddball regex doc Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39678 Cc: Tomasz Dziendzielski , Jim Meyering X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Looking again at grep bug 39678 I noticed that the bug occurs even when grep is not coloring: echo a | grep -oi --color=never '\a' This outputs nothing and exits with status 0, which is clearly wrong. I tracked this down to a bug buried deep in the bowels of glibc regex, a bug that Tomasz also spotted. It's not trivial to fix (the fix that Tomasz sent in doesn't feel right, at least for \X where X is a multibyte letter) and any fix would be low priority since the bug occurs only in regular expressions like '\a' that have unspecified behavior - which means the behavior though wrong nevertheless conforms to POSIX. I'm inclined to address this by having GNU 'grep' diagnose unspecified regexps like '\a' and exit with status 2, much as it already diagnoses unspecified regexps like '[:alpha:]'. If this approach sounds too drastic, a gentler approach would be for 'grep' to warn about '\a' without changing the exit status for now, and escalate the warning to exit with status 2 in a later 'grep' release. From debbugs-submit-bounces@debbugs.gnu.org Sat May 21 14:41:22 2022 Received: (at 39678) by debbugs.gnu.org; 21 May 2022 18:41:22 +0000 Received: from localhost ([127.0.0.1]:42936 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsU2U-0001sT-H2 for submit@debbugs.gnu.org; Sat, 21 May 2022 14:41:22 -0400 Received: from mail-lf1-f41.google.com ([209.85.167.41]:33461) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsU2Q-0001sD-Rb for 39678@debbugs.gnu.org; Sat, 21 May 2022 14:41:21 -0400 Received: by mail-lf1-f41.google.com with SMTP id bu29so19375937lfb.0 for <39678@debbugs.gnu.org>; Sat, 21 May 2022 11:41:18 -0700 (PDT) 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=643oe4JQdSCx8Psawz9+xHALIcmJX3gTf5b0hnfg0Dg=; b=E1nnigrooCB2CvLP5L1b9LVfrEEo0BnwH3o4k+gFczg1ZNBPsc6+7jzrA5+Utd5OJC cncomwPRUmVeYH9fzWBS2S1qT1TQqX4oMgDo3PEW4n4f4il3LbdQcjRag90Gn6y/psj9 MueJQK2yyjK86CNBZhcYyV1/d/K+Kt9fe8YxaJJ6p94n4a9jc3Fxzr/onvryd8PjMkLC lBRRD+jfXfpJeioQfGuNsZgIZLuLHZ3elRXvRSGfTNjqLmWTWZqGerRJY3gFPf0svqKW Peg9lDj2NGOQZNR71qL1l9a7kB6V+rhLWJladfpK2WGdklM4L2MFJ3NFsBFIsHyscg9V M9SQ== X-Gm-Message-State: AOAM530TC0TrWyPk3yqZAmS7z7fb2DMXZbk5T4Ls3HeBZNL8pU9wjZ/5 /NcHl3QZSU0EF35RhjPFQBBUPkpdx04r6G44NXo= X-Google-Smtp-Source: ABdhPJzrNitzr6KcJbQSsZvhG41cGQBIGJqL9inAaz0Qy9aSLE6qUpQiobDENCcJ+kF1WO8ph33x7IEO7s5lO4Adoog= X-Received: by 2002:a05:6512:3b24:b0:478:5c14:b9f1 with SMTP id f36-20020a0565123b2400b004785c14b9f1mr3850942lfv.47.1653158472853; Sat, 21 May 2022 11:41:12 -0700 (PDT) MIME-Version: 1.0 References: <9b607770-3676-60fb-17a4-96d025862a3c@cs.ucla.edu> In-Reply-To: <9b607770-3676-60fb-17a4-96d025862a3c@cs.ucla.edu> From: Jim Meyering Date: Sat, 21 May 2022 11:40:58 -0700 Message-ID: Subject: Re: POSIXLY_CORRECT removal, and oddball regex doc To: Paul Eggert Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org, Tomasz Dziendzielski X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On Sat, May 21, 2022 at 3:05 AM Paul Eggert wrote: > Looking again at grep bug 39678 I noticed > that the bug occurs even when grep is not coloring: > > echo a | grep -oi --color=never '\a' > > This outputs nothing and exits with status 0, which is clearly wrong. Wrong, indeed! > I tracked this down to a bug buried deep in the bowels of glibc regex, a > bug that Tomasz also spotted. It's not trivial to fix (the fix that > Tomasz sent in doesn't feel right, at least for \X where X is a > multibyte letter) and any fix would be low priority since the bug occurs > only in regular expressions like '\a' that have unspecified behavior - > which means the behavior though wrong nevertheless conforms to POSIX. > > I'm inclined to address this by having GNU 'grep' diagnose unspecified > regexps like '\a' and exit with status 2, much as it already diagnoses > unspecified regexps like '[:alpha:]'. If this approach sounds too > drastic, a gentler approach would be for 'grep' to warn about '\a' > without changing the exit status for now, and escalate the warning to > exit with status 2 in a later 'grep' release. In my experience, there are many lurking uses of things like '\a', and would like to ease into this gently, so I much prefer your latter approach: warn now, and change grep's exit status later -- at least 6 months to a year later, to give people at least a chance to fix their offending uses before they break. Thanks for all the improvements! From debbugs-submit-bounces@debbugs.gnu.org Sun May 22 18:24:22 2022 Received: (at 39678) by debbugs.gnu.org; 22 May 2022 22:24:22 +0000 Received: from localhost ([127.0.0.1]:46608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nstzn-0008MB-3z for submit@debbugs.gnu.org; Sun, 22 May 2022 18:24:22 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nstyl-0008Kc-Kk for 39678@debbugs.gnu.org; Sun, 22 May 2022 18:24:18 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id D1CA6160144; Sun, 22 May 2022 15:23:01 -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 d7B38XsUrAYv; Sun, 22 May 2022 15:22:59 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CD1F5160147; Sun, 22 May 2022 15:22:59 -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 Uce9nBqTwzeo; Sun, 22 May 2022 15:22:59 -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 9AC7A160144; Sun, 22 May 2022 15:22:59 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------Ix8qF2vbq4doRIQciPHlIYgU" Message-ID: Date: Sun, 22 May 2022 15:22:59 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Content-Language: en-US To: Jim Meyering References: <9b607770-3676-60fb-17a4-96d025862a3c@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: bug#39678: POSIXLY_CORRECT removal, and oddball regex doc In-Reply-To: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 39678 Cc: 39678@debbugs.gnu.org, Tomasz Dziendzielski X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is a multi-part message in MIME format. --------------Ix8qF2vbq4doRIQciPHlIYgU Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/21/22 11:40, Jim Meyering wrote: > In my experience, there are many lurking uses of things like '\a', and > would like to ease into this gently, so I much prefer your latter > approach: warn now, and change grep's exit status later Sounds good. When I started looking into that, I discovered that the grep manual doesn't cover these lurkers well. And although I installed a patch yesterday about this, after looking at the POSIX spec again today I discovered that I'd missed quite a few lurkers. So I just now installed the attached documentation fix, which attempts to cover all the remaining problem regexps, and to give us room to add warnings for some of them soon. We shouldn't warn about all these problems, not without a --pedantic flag or something like that (something I'm probably too busy to add). But I expect it'd be good to warn about areas where grep's semantics don't match any reasonable expectation. We've already uncovered one area, where \a doesn't work as expected and where a warning diagnostic would be helpful. Here's another one, where an oddly-placed '*' doesn't work as one would expect: $ printf '*\na\n*a\n' | grep '\(*\)' * *a $ printf '*\na\n*a\n' | grep -E '(*)' grep: Unmatched ( or \( $ printf '*\na\n*a\n' | grep '\(*a\)' *a $ printf '*\na\n*a\n' | grep -E '(*a)' a *a Although not a POSIX violation, here 'grep -E' is "wrong" for any reasonable definition of "wrong" that I can think of. The attached patch changes the doc to say that this regular expression has unspecified behavior (something that POSIX allows). (Who would have thought regular expressions were so complicated? :-) --------------Ix8qF2vbq4doRIQciPHlIYgU Content-Type: text/x-patch; charset=UTF-8; name="0001-doc-document-regex-corner-cases-better.patch" Content-Disposition: attachment; filename="0001-doc-document-regex-corner-cases-better.patch" Content-Transfer-Encoding: base64 RnJvbSBhODYwYmQzOWUzODRlZDYxMTFiYzYzZmU2YWFiZWI3ZjcxMjBlNmQ1IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTdW4sIDIyIE1heSAyMDIyIDE0OjU5OjUzIC0wNzAwClN1YmplY3Q6IFtQQVRD SF0gZG9jOiBkb2N1bWVudCByZWdleCBjb3JuZXIgY2FzZXMgYmV0dGVyCgoqIGRvYy9ncmVw LnRleGkgKEVudmlyb25tZW50IFZhcmlhYmxlcykKKEZ1bmRhbWVudGFsIFN0cnVjdHVyZSwg Q2hhcmFjdGVyIENsYXNzZXMgYW5kIEJyYWNrZXQgRXhwcmVzc2lvbnMpCihTcGVjaWFsIEJh Y2tzbGFzaCBFeHByZXNzaW9ucywgQmFjay1yZWZlcmVuY2VzIGFuZCBTdWJleHByZXNzaW9u cykKKEJhc2ljIHZzIEV4dGVuZGVkKTogU2F5IG1vcmUgcHJlY2lzZWx5IHdoYXQgaGFwcGVu cyB3aXRoCnByb2JsZW1hdGljIHJlZ3VsYXIgZXhwcmVzc2lvbnMuCihQcm9ibGVtYXRpYyBF eHByZXNzaW9ucyk6IE5ldyBzZWN0aW9uLgotLS0KIE5FV1MgICAgICAgICAgfCAgIDUgKysK IGRvYy9ncmVwLnRleGkgfCAyMjQgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKy0tLS0tLS0tLS0tLS0KI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eSBsaW5lcywgdXNlIHRoZSBwYXR0ZXJuIEBzYW1we14kfS4gIFRvIG1hdGNoIGJsYW5rCiBs aW5lcywgdXNlIHRoZSBwYXR0ZXJuIEBzYW1we15bWzpibGFuazpdXSokfS4gIFRvIG1hdGNo IG5vIGxpbmVzIGF0Ci1hbGwsIHVzZSB0aGUgY29tbWFuZCBAc2FtcHtncmVwIC1mIC9kZXYv bnVsbH0uCithbGwsIHVzZSBhbiBleHRlbmRlZCByZWd1bGFyIGV4cHJlc3Npb24gbGlrZSBA c2FtcHthXn0gb3IgQHNhbXB7JGF9LgorVG8gbWF0Y2ggZXZlcnkgbGluZSwgYSBwb3J0YWJs ZSBzY3JpcHQgc2hvdWxkIHVzZSBhIHBhdHRlcm4gbGlrZQorQHNhbXB7Xn0gaW5zdGVhZCBv ZiB0aGUgZW1wdHkgcGF0dGVybiwgYXMgUE9TSVggZG9lcyBub3Qgc3BlY2lmeSB0aGUKK2Jl aGF2aW9yIG9mIHRoZSBlbXB0eSBwYXR0ZXJuLgogCiBAaXRlbQogSG93IGNhbiBJIHNlYXJj aCBpbiBib3RoIHN0YW5kYXJkIGlucHV0IGFuZCBpbiBmaWxlcz8KLS0gCjIuMzQuMQoK --------------Ix8qF2vbq4doRIQciPHlIYgU-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 23 16:03:10 2022 Received: (at submit) by debbugs.gnu.org; 23 May 2022 20:03:10 +0000 Received: from localhost ([127.0.0.1]:50272 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntEGj-0001ol-Rq for submit@debbugs.gnu.org; Mon, 23 May 2022 16:03:10 -0400 Received: from lists.gnu.org ([209.51.188.17]:42750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntEGh-0001oa-0g for submit@debbugs.gnu.org; Mon, 23 May 2022 16:03:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEGg-0000xg-RJ for bug-grep@gnu.org; Mon, 23 May 2022 16:03:06 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:38444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEGe-0006JL-Aj for bug-grep@gnu.org; Mon, 23 May 2022 16:03:06 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C0CEA160158 for ; Mon, 23 May 2022 13:03:01 -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 XxMQ0yqcTUaG for ; Mon, 23 May 2022 13:03:00 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 9E67B160159 for ; Mon, 23 May 2022 13:03:00 -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 7c2LwepeQjkl for ; Mon, 23 May 2022 13:03:00 -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 777ED160158 for ; Mon, 23 May 2022 13:03:00 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------6wvxlN6f7V9Vbf1ckJdoxpIs" Message-ID: Date: Mon, 23 May 2022 13:03:00 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Content-Language: en-US To: bug-grep@gnu.org References: <9b607770-3676-60fb-17a4-96d025862a3c@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: bug#39678: warn about stray backslashes In-Reply-To: Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------6wvxlN6f7V9Vbf1ckJdoxpIs Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/22/22 15:22, Paul Eggert wrote: > We've already uncovered one area, where \a doesn't work as expected and > where a warning diagnostic would be helpful. I installed the attached patch to cause 'grep' to warn about these. Comments welcome. Most of the changes were in Gnulib's dfa module, which see. > Here's another one, where an oddly-placed '*' doesn't work as one would expect: > > $ printf '*\na\n*a\n' | grep '\(*\)' > * > *a > $ printf '*\na\n*a\n' | grep -E '(*)' > grep: Unmatched ( or \( > $ printf '*\na\n*a\n' | grep '\(*a\)' > *a > $ printf '*\na\n*a\n' | grep -E '(*a)' > a > *a I plan to look at this next. We shouldn't warn about BREs like '\(*\)' and '\(*a\)' as these conform to POSIX and work fine. But it makes sense to warn about EREs like '(*)', '(*a)', '(+)', '(+a)', '({1})', '({1}a)' as POSIX does not specify their behavior, their semantics are unpredictable with GNU grep, and it's plausible that people are making mistakes in this area. --------------6wvxlN6f7V9Vbf1ckJdoxpIs Content-Type: text/x-patch; charset=UTF-8; name="0001-build-update-gnulib-submodule-to-latest.patch" Content-Disposition: attachment; filename="0001-build-update-gnulib-submodule-to-latest.patch" Content-Transfer-Encoding: base64 RnJvbSA0MmRiNWNjOGY1ODYyMGI0YzljNThhOTFjNzY4MzI3OWM1MDUwM2Y5IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBNb24sIDIzIE1heSAyMDIyIDEyOjIyOjE1IC0wNzAwClN1YmplY3Q6IFtQQVRD SCAxLzJdIGJ1aWxkOiB1cGRhdGUgZ251bGliIHN1Ym1vZHVsZSB0byBsYXRlc3QKCi0tLQog Z251bGliIHwgMiArLQogMSBmaWxlIGNoYW5nZWQsIDEgaW5zZXJ0aW9uKCspLCAxIGRlbGV0 aW9uKC0pCgpkaWZmIC0tZ2l0IGEvZ251bGliIGIvZ251bGliCmluZGV4IGIxOWExMDcuLjU1 ZDFhNzMgMTYwMDAwCi0tLSBhL2dudWxpYgorKysgYi9nbnVsaWIKQEAgLTEgKzEgQEAKLVN1 YnByb2plY3QgY29tbWl0IGIxOWExMDc3NWU1NGY4ZWQxN2UzYThjMDhhNzJkMjYxZDhjMjYy NDQKK1N1YnByb2plY3QgY29tbWl0IDU1ZDFhNzNjMWE3OWU5NGM0NDNmNTE3OThjNGM3NjQ0 OWEwYzdkNjIKLS0gCjIuMzQuMQoK --------------6wvxlN6f7V9Vbf1ckJdoxpIs Content-Type: text/x-patch; charset=UTF-8; name="0002-grep-warn-about-stray-backslashes.patch" Content-Disposition: attachment; filename="0002-grep-warn-about-stray-backslashes.patch" Content-Transfer-Encoding: base64 RnJvbSBlN2Y4ZThlYjFmZDQxYjMwOGVlMTA3NDFiYmQ4MDY4YWNjMTg0N2MyIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 P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Zhc2VhcmNoLmMKQEAgLTUzLDEwICs1 MywxMCBAQCBkZmFlcnJvciAoY2hhciBjb25zdCAqbWVzZykKICAgZGllIChFWElUX1RST1VC TEUsIDAsICIlcyIsIG1lc2cpOwogfQogCi1fTm9yZXR1cm4gdm9pZAordm9pZAogZGZhd2Fy biAoY2hhciBjb25zdCAqbWVzZykKIHsKLSAgZGZhZXJyb3IgKG1lc2cpOworICBlcnJvciAo MCwgMCwgXygid2FybmluZzogJXMiKSwgbWVzZyk7CiB9CiAKIC8qIElmIHRoZSBERkEgdHVy bnMgb3V0IHRvIGhhdmUgc29tZSBzZXQgb2YgZml4ZWQgc3RyaW5ncyBvbmUgb2YKQEAgLTE5 Niw3ICsxOTYsOCBAQCBHRUFjb21waWxlIChjaGFyICpwYXR0ZXJuLCBpZHhfdCBzaXplLCBy ZWdfc3ludGF4X3Qgc3ludGF4X2JpdHMsCiAKICAgaWYgKG1hdGNoX2ljYXNlKQogICAgIHN5 bnRheF9iaXRzIHw9IFJFX0lDQVNFOwotICBpbnQgZGZhb3B0cyA9IGVvbGJ5dGUgPyAwIDog REZBX0VPTF9OVUw7CisgIGludCBkZmFvcHRzID0gKERGQV9DT05GVVNJTkdfQlJBQ0tFVFNf RVJST1IgfCBERkFfU1RSQVlfQkFDS1NMQVNIX1dBUk4KKyAgICAgICAgICAgICAgICAgfCAo ZW9sYnl0ZSA/IDAgOiBERkFfRU9MX05VTCkpOwogICBkZmFzeW50YXggKGRjLT5kZmEsICZs b2NhbGVpbmZvLCBzeW50YXhfYml0cywgZGZhb3B0cyk7CiAgIGJvb2wgYnNfc2FmZSA9ICFs b2NhbGVpbmZvLm11bHRpYnl0ZSB8IGxvY2FsZWluZm8udXNpbmdfdXRmODsKIAotLSAKMi4z NC4xCgo= --------------6wvxlN6f7V9Vbf1ckJdoxpIs-- From debbugs-submit-bounces@debbugs.gnu.org Tue May 24 20:52:59 2022 Received: (at submit) by debbugs.gnu.org; 25 May 2022 00:52:59 +0000 Received: from localhost ([127.0.0.1]:53898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntfGk-0007YD-KV for submit@debbugs.gnu.org; Tue, 24 May 2022 20:52:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:34008) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ntfGh-0007Y2-SA for submit@debbugs.gnu.org; Tue, 24 May 2022 20:52:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntfGh-0007ec-Kd for bug-grep@gnu.org; Tue, 24 May 2022 20:52:55 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:37922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntfGe-00029T-Tj for bug-grep@gnu.org; Tue, 24 May 2022 20:52:54 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C61E21600D1 for ; Tue, 24 May 2022 17:52:49 -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 R-DEKNzUISCY for ; Tue, 24 May 2022 17:52:48 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 88AA41600FF for ; Tue, 24 May 2022 17:52:48 -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 EiHokdT0Rll1 for ; Tue, 24 May 2022 17:52:48 -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 63E351600D1 for ; Tue, 24 May 2022 17:52:48 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------PDgNRSGXKKqC5u0CInndPOUF" Message-ID: Date: Tue, 24 May 2022 17:52:48 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: bug#39678: warn about stray backslashes Content-Language: en-US From: Paul Eggert To: bug-grep@gnu.org References: <9b607770-3676-60fb-17a4-96d025862a3c@cs.ucla.edu> Organization: UCLA Computer Science Department In-Reply-To: Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This is a multi-part message in MIME format. --------------PDgNRSGXKKqC5u0CInndPOUF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/23/22 13:03, Paul Eggert wrote: > it makes sense to warn about EREs like '(*)', '(*a)', '(+)', '(+a)', > '({1})', '({1}a)' as POSIX does not specify their behavior, their > semantics are unpredictable with GNU grep, and it's plausible that > people are making mistakes in this area. I installed the attached to do that. As before, most of the changes were in Gnulib's dfa module. With all these changes, we now see behavior like this: $ echo a | src/grep -oi '\a' src/grep: warning: stray \ before a which is not ideal (so I'll leave the bug report open), but at least this gives the user a warning that the pattern is not on the up-and-up. --------------PDgNRSGXKKqC5u0CInndPOUF Content-Type: text/x-patch; charset=UTF-8; name="0001-build-update-gnulib-submodule-to-latest.patch" Content-Disposition: attachment; filename="0001-build-update-gnulib-submodule-to-latest.patch" Content-Transfer-Encoding: base64 RnJvbSA2ODJjNTEzOGJiNjVlOTBmYmE2OTVhNmJjYjE3YjMzZDRjZTdlZDdmIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBUdWUsIDI0IE1heSAyMDIyIDE2OjA1OjE4IC0wNzAwClN1YmplY3Q6IFtQQVRD SCAxLzJdIGJ1aWxkOiB1cGRhdGUgZ251bGliIHN1Ym1vZHVsZSB0byBsYXRlc3QKCi0tLQog Z251bGliIHwgMiArLQogMSBmaWxlIGNoYW5nZWQsIDEgaW5zZXJ0aW9uKCspLCAxIGRlbGV0 aW9uKC0pCgpkaWZmIC0tZ2l0IGEvZ251bGliIGIvZ251bGliCmluZGV4IDU1ZDFhNzMuLjg4 ZDM1OTggMTYwMDAwCi0tLSBhL2dudWxpYgorKysgYi9nbnVsaWIKQEAgLTEgKzEgQEAKLVN1 YnByb2plY3QgY29tbWl0IDU1ZDFhNzNjMWE3OWU5NGM0NDNmNTE3OThjNGM3NjQ0OWEwYzdk NjIKK1N1YnByb2plY3QgY29tbWl0IDg4ZDM1OThhMjc3MDYxYjg1NWM3NzgxMDNjMWY1YTEx NGVhMGFmZDcKLS0gCjIuMzYuMQoK --------------PDgNRSGXKKqC5u0CInndPOUF Content-Type: text/x-patch; charset=UTF-8; name="0002-grep-warn-about-x-etc.patch" Content-Disposition: attachment; filename="0002-grep-warn-about-x-etc.patch" Content-Transfer-Encoding: base64 RnJvbSA3NGRhZWY1OTg2ZTNkNTJmMGVjODVkYzFhYTU0MTFmMjZlYTkyYmJiIE1vbi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