From unknown Sat Aug 16 22:47:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#44352: Incorrect matches for some ERE Resent-From: Gonzalo Padrino Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Sat, 31 Oct 2020 16:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44352 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 44352@debbugs.gnu.org X-Debbugs-Original-To: bug-grep@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160416102713684 (code B ref -1); Sat, 31 Oct 2020 16:18:01 +0000 Received: (at submit) by debbugs.gnu.org; 31 Oct 2020 16:17:07 +0000 Received: from localhost ([127.0.0.1]:34389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYtYw-0003Ye-He for submit@debbugs.gnu.org; Sat, 31 Oct 2020 12:17:07 -0400 Received: from lists.gnu.org ([209.51.188.17]:33592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYsmD-00005S-8j for submit@debbugs.gnu.org; Sat, 31 Oct 2020 11:26:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYsmD-0008LT-2v for bug-grep@gnu.org; Sat, 31 Oct 2020 11:26:45 -0400 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]:40989) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kYsmB-0007xJ-3e for bug-grep@gnu.org; Sat, 31 Oct 2020 11:26:44 -0400 Received: by mail-il1-x131.google.com with SMTP id x20so9126654ilj.8 for ; Sat, 31 Oct 2020 08:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=naILjtZAKLDMvKRSJzFiYhGpNFx4LLJnnnt5lhzFyxw=; b=YB/rI6fK3hdghmCSJRD2SAg6z5mCjpKPTzvbXfGyBCLLpTCHlOuq2WxztTslKVbTeY yf8RsldU+xI79WoJtzkN+oeCp0Q2dxT1wta7c+t86sJb3TPNuplV4nzh9fROYO3buhve hN99QTr6OeGiuIE0TO1Z6VdWuFhqY7e1ze5jBEviDctOuMvuqCHKothZCMTOpsRj4QTV gradmMDVGLE3hvCa9jA4v5uGffluFSmG3U/XcHLVkOisxazDcpNCHEDra6hcV/PSo00p LIUmNj7FxLG7l/Fuuv+zA+PCz4Z+D6RfmzshuchhJf7N1NMEYgbdIdFm7pexdiKFzGlg skeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=naILjtZAKLDMvKRSJzFiYhGpNFx4LLJnnnt5lhzFyxw=; b=bstRUqs1wIG3rzjYdfGFVXV6IYrkIAxoJT9Aim+3BvWnzf47antoSU5dSNcAkGeMdV r21WROE4DCd3oSLQCsdZqmwovBonYKLBL6duzEJiHoIDhklWOyb0aKE28JujsT/qQmQ5 1bmBRVgC9oYuR/NqnjhM4io+a375mDfTaDHoTXYlxrZ97x7Bgf926fIjXGMSy1oB0Wcn AWP+81rrCBSgYmIizLrJW0MggEqWFVDUkCi/TmCct7QGLvFFpZexbf+rubNS1gkabbq8 f/zBtuz0Xd4O0ckVxkKZZuahOXpPe/SHdrsld+N4vRflmUqNmFOnPOmQhsBXrgXjRW7N +dcg== X-Gm-Message-State: AOAM531E1G9kL6SwrX2guUBdaqyIoeQM87dGDet4dRpXl6dbzbO6e/gC cJwrVmp2fltnoGhhvh7/auUl5Fd5c2wyUdrpifTOwfV39mM= X-Google-Smtp-Source: ABdhPJxGkUgwf1oUWYYXp+qwtXrRGhbTnc9DjFJeKYGAT0igerU8Bgix19Naqk255mImG5y19SH973vpl4DfzC7po/s= X-Received: by 2002:a92:290b:: with SMTP id l11mr5732799ilg.46.1604158001669; Sat, 31 Oct 2020 08:26:41 -0700 (PDT) MIME-Version: 1.0 From: Gonzalo Padrino Date: Sat, 31 Oct 2020 16:26:25 +0100 Message-ID: Content-Type: multipart/alternative; boundary="000000000000da68f405b2f923c0" Received-SPF: pass client-ip=2607:f8b0:4864:20::131; envelope-from=grimalgon@gmail.com; helo=mail-il1-x131.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Mailman-Approved-At: Sat, 31 Oct 2020 12:17:05 -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: -2.3 (--) --000000000000da68f405b2f923c0 Content-Type: text/plain; charset="UTF-8" While using GNU grep v3.4 in an Ubuntu 20.04 userspace running on top of Win10 WSL (yeah, i know... but also checked in other envs) i discovered what seems like an obvious bug (if i'm not mistaken). The bug: ----- me@host:~$ echo 'xxxxy' |grep -E '^x+x+x+x+y$' xxxxy me@host:~$ echo 'xxxy' |grep -E '^x+x+x+x+y$' xxxy me@host:~$ echo 'xxy' |grep -E '^x+x+x+x+y$' xxy me@host:~$ echo 'xy' |grep -E '^x+x+x+x+y$' ---- ...the terminal supports ansi color escapes, and what's really weird is that only the result from the first command is colored in red. First and fourth commands yield correct results; the second and third do not, as they should not match it's input. I've tested releases from v3.1 to latest v3.5 and found the anomalous behaviour in version v3.2 through v3.5. A (quick and clunky) git bisect led me to believe it was introduced about two years ago, possibly in commit 123620af88f55c3e0cc9f0aed7311c72f625bc82 ( https://git.savannah.gnu.org/cgit/grep.git/commit/?id=123620af88f55c3e0cc9f0aed7311c72f625bc82 ). If this is true, it would mean either the bug is in gnulib, or maybe grep needed to do some kind of extra handling on it's side. Kind regards. Gonzalo Padrino. P.S.: I had to patch some things in order to successfully compile the code after checking out some problematic commits (pragmas to avoid warnings about "pure" and "noreturn" function attributes, a missing configmake dependency in bootstrap.conf, etc ). P.S.: Resending message since first got lost in aether apparently. --000000000000da68f405b2f923c0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=C2=A0 While using GNU grep v3.4 in an Ubuntu 20.04 usersp= ace running on top of
Win10 WSL (yeah, i know... but also checked in oth= er envs) i discovered
what seems like an obvious bug (if i'm not mis= taken).

=C2=A0 The bug:
-----
me@host:~$ =C2= =A0echo 'xxxxy' |grep -E '^x+x+x+x+y$'
xxxxy
me@host:= ~$ =C2=A0echo 'xxxy' |grep -E '^x+x+x+x+y$'
xxxy
me@h= ost:~$ =C2=A0echo 'xxy' |grep -E '^x+x+x+x+y$'
xxy
me= @host:~$ =C2=A0echo 'xy' |grep -E '^x+x+x+x+y$'

----=
...the terminal supports ansi color escapes, and what's really weir= d is
that only the result from the first command is colored in red. Firs= t and
fourth commands yield correct results; the second and third do not= , as they
should not match it's input.

=C2=A0 I've tested= releases from v3.1 to latest v3.5 and found the anomalous
behaviour in = version v3.2 through v3.5. A (quick and clunky) git bisect led
me to bel= ieve it was introduced about two years ago, possibly in commit
123620af8= 8f55c3e0cc9f0aed7311c72f625bc82 (
http= s://git.savannah.gnu.org/cgit/grep.git/commit/?id=3D123620af88f55c3e0cc9f0a= ed7311c72f625bc82).
If this is true, it would mean either the bug is= in gnulib, or maybe grep
needed to do some kind of extra handling on it= 's side.

Kind regards. Gonzalo Padrino.

P.S.: I had to pa= tch some things in order to successfully compile the code
after checking= out some problematic commits (pragmas to avoid warnings
about "pur= e" and "noreturn" function attributes, a missing configmake<= br>
dependency in bootstrap.conf, etc ).

P.S.:= Resending message since first got lost in aether apparently.
--000000000000da68f405b2f923c0-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 31 14:50:35 2020 Received: (at control) by debbugs.gnu.org; 31 Oct 2020 18:50:36 +0000 Received: from localhost ([127.0.0.1]:34534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYvxT-00018H-Mj for submit@debbugs.gnu.org; Sat, 31 Oct 2020 14:50:35 -0400 Received: from mail-wr1-f54.google.com ([209.85.221.54]:44808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYvxR-000183-Ob for control@debbugs.gnu.org; Sat, 31 Oct 2020 14:50:34 -0400 Received: by mail-wr1-f54.google.com with SMTP id b3so4073893wrx.11 for ; Sat, 31 Oct 2020 11:50:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=p4gL0AJBi/9gctcAAVIho9j7FqQG/evjoTQTwQASTpE=; b=f+w4R45IxoV2UfcOVDqp/2jjoGdoZxU1JO6KCruD1wSlSlJdUjA8YPjjZYQiyotkwc Ya1DSYPxQHriGdIXY1MHUjpy7ld9tFga+972mtqSvJ8QLJLHCV8iGtCNYPlV/ncI/sAY EMwndPfm7vtlOezlMOpPwKIJ1r4hm/7jGRon1SW79IZaoh52WMKz2fJCVfU9Ru28I6G3 DBx13Avg4Mf9BrE3mKKntmntryRblxOJbb6l/FjJbjqaKv/ga2fTlqXZqkLUzo8/bCE8 NOApSJSE2M5InLFM0xebZZNH2hrbkyoU9xcdep3fZeYa0BwdIpp7P7K/Rpo33hNdAZ8u IjPA== X-Gm-Message-State: AOAM533NNrQI9gf8FwBqdjaxx+GaOg8+189oGleO9HqGduO8mbgFlFQw aeCOziA9rF9y8aCSzFPp0rwzf5HH4wXVPqZtuS6XrWEYmPE= X-Google-Smtp-Source: ABdhPJx3/sUHvfFc4bO79NdGQWDgpYR1RohH2WvmKLin+UWqBIVCDNHDp3Rd/iKGoRuZpfNW9upSPoITXIjHg31Ddhw= X-Received: by 2002:adf:e811:: with SMTP id o17mr4787340wrm.306.1604170227427; Sat, 31 Oct 2020 11:50:27 -0700 (PDT) MIME-Version: 1.0 From: Jim Meyering Date: Sat, 31 Oct 2020 11:50:15 -0700 Message-ID: Subject: merge To: GNU bug tracker automated control server Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) 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: -0.5 (/) merge 44352 44351 stop From unknown Sat Aug 16 22:47:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#44352: Incorrect matches for some ERE Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Sat, 31 Oct 2020 18:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44352 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Gonzalo Padrino Cc: 44352@debbugs.gnu.org Received: via spool by 44352-submit@debbugs.gnu.org id=B44352.16041703094496 (code B ref 44352); Sat, 31 Oct 2020 18:52:01 +0000 Received: (at 44352) by debbugs.gnu.org; 31 Oct 2020 18:51:49 +0000 Received: from localhost ([127.0.0.1]:34539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYvyf-0001AS-0G for submit@debbugs.gnu.org; Sat, 31 Oct 2020 14:51:49 -0400 Received: from mail-wm1-f44.google.com ([209.85.128.44]:34948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kYvyd-0001AC-6h for 44352@debbugs.gnu.org; Sat, 31 Oct 2020 14:51:48 -0400 Received: by mail-wm1-f44.google.com with SMTP id h22so5774825wmb.0 for <44352@debbugs.gnu.org>; Sat, 31 Oct 2020 11:51:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JzPRXsUcpI0vbPENXhjaDvAvJMoCCYQOhdc/fyKBVHo=; b=J5fUzMT+l3uCeJcoSp5vu6/icxG80+KHVtqre8zuuoM+QLSzHTbpDW8/KWXKYovrqD y6pkkrTkA/cSiVsz6hWEwz/sC4p41nI/GLgsBX4m1bR794/wpZEKmSyvjSWfbTCGB2oF Ai+l37MOzjCFMOCKZ0UvvyxOVoWVOgqhjEC3hVZEppy862v4fp+Kie2GGpS5i6agLlq3 rT0qKwsR/+zozn7gyg2xdtXiUmbmPrsCShUmrbb9D4cQteLklrCsJecrSkgzmgLsQbfM cLxlgmtnemH0jIwaUEHkdLrQ2YoxK5p6oahcRxt4LQTvfUPxsaZpwD+JcifCGXZnPXff bzEA== X-Gm-Message-State: AOAM532tX8Wa9x8WegesKDVE4GpS7ACTA1AOppBRhYh9HNW10XIXJXwk BIZfuJKV097CoUm0BLp+Q/xCURn40vF7dH576XQ= X-Google-Smtp-Source: ABdhPJxHXL+KIw2N172MIyG9UZc6vsc+zr28v/FgyeEEY3Hr/cAwkMCBgGDyqfaF7k+I460AUjW0oIFcJ+DN2qpIOOw= X-Received: by 2002:a05:600c:2888:: with SMTP id g8mr9217433wmd.130.1604170301525; Sat, 31 Oct 2020 11:51:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jim Meyering Date: Sat, 31 Oct 2020 11:51:29 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) 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, Oct 31, 2020 at 9:18 AM Gonzalo Padrino wrote: > While using GNU grep v3.4 in an Ubuntu 20.04 userspace running on top of > Win10 WSL (yeah, i know... but also checked in other envs) i discovered > what seems like an obvious bug (if i'm not mistaken). > > The bug: > ----- > me@host:~$ echo 'xxxxy' |grep -E '^x+x+x+x+y$' > xxxxy > me@host:~$ echo 'xxxy' |grep -E '^x+x+x+x+y$' > xxxy > me@host:~$ echo 'xxy' |grep -E '^x+x+x+x+y$' > xxy > me@host:~$ echo 'xy' |grep -E '^x+x+x+x+y$' > > ---- > ...the terminal supports ansi color escapes, and what's really weird is > that only the result from the first command is colored in red. First and > fourth commands yield correct results; the second and third do not, as they > should not match it's input. > > I've tested releases from v3.1 to latest v3.5 and found the anomalous > behaviour in version v3.2 through v3.5. A (quick and clunky) git bisect led > me to believe it was introduced about two years ago, possibly in commit > 123620af88f55c3e0cc9f0aed7311c72f625bc82 ( > https://git.savannah.gnu.org/cgit/grep.git/commit/?id=123620af88f55c3e0cc9f0aed7311c72f625bc82 > ). > If this is true, it would mean either the bug is in gnulib, or maybe grep > needed to do some kind of extra handling on it's side. > > Kind regards. Gonzalo Padrino. > > P.S.: I had to patch some things in order to successfully compile the code > after checking out some problematic commits (pragmas to avoid warnings > about "pure" and "noreturn" function attributes, a missing configmake > dependency in bootstrap.conf, etc ). > > P.S.: Resending message since first got lost in aether apparently. Thanks. It was not lost. Conversation is continuing on https://bugs.gnu.org/44351