GNU bug report logs - #36148
inconsistent behaviour with anchored regex containing back-references

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Reported by: g1pi@HIDDEN; merged with #26864; dated Sun, 9 Jun 2019 15:30:02 UTC; Maintainer for grep is bug-grep@HIDDEN.

Message received at 36148 <at> debbugs.gnu.org:


Received: (at 36148) by debbugs.gnu.org; 2 Jan 2020 09:37:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 04:37:28 2020
Received: from localhost ([127.0.0.1]:38189 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1imwv2-0001gB-Ih
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2020 04:37:28 -0500
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48218)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1imwv1-0001fx-HD
 for 36148 <at> debbugs.gnu.org; Thu, 02 Jan 2020 04:37:27 -0500
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id F3B85160017;
 Thu,  2 Jan 2020 01:37:21 -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 2hQvgPSBW9BX; Thu,  2 Jan 2020 01:37:21 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 28C5C160054;
 Thu,  2 Jan 2020 01:37:21 -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 0R1K6kuUYD7Y; Thu,  2 Jan 2020 01:37:21 -0800 (PST)
Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com
 [23.242.74.103])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id F256C160017;
 Thu,  2 Jan 2020 01:37:20 -0800 (PST)
To: g1pi@HIDDEN
From: Paul Eggert <eggert@HIDDEN>
Subject: Re: inconsistent behaviour with anchored regex containing
 back-references
Organization: UCLA Computer Science Department
Message-ID: <1ded0af3-1c7d-9386-0ccb-dc75527c83de@HIDDEN>
Date: Thu, 2 Jan 2020 01:37:20 -0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.2.2
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36148
Cc: 36148 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Yes, back-references don't work very well. This looks to be the same bug as
Bug#26864 <https://bugs.gnu.org/26864> so I have merged the two bug reports.




Information forwarded to bug-grep@HIDDEN:
bug#36148; Package grep. Full text available.
Merged 26864 36148. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Jun 2019 15:29:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 09 11:29:23 2019
Received: from localhost ([127.0.0.1]:55213 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hZzl4-0001d7-51
	for submit <at> debbugs.gnu.org; Sun, 09 Jun 2019 11:29:22 -0400
Received: from lists.gnu.org ([209.51.188.17]:46497)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <g1pi@HIDDEN>) id 1hZskq-0005MQ-82
 for submit <at> debbugs.gnu.org; Sun, 09 Jun 2019 04:00:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50605)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <g1pi@HIDDEN>) id 1hZskp-0006r5-0r
 for bug-grep@HIDDEN; Sun, 09 Jun 2019 04:00:40 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <g1pi@HIDDEN>) id 1hZsko-0001Y5-45
 for bug-grep@HIDDEN; Sun, 09 Jun 2019 04:00:38 -0400
Received: from smtp-36.italiaonline.it ([213.209.10.36]:57428 helo=libero.it)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <g1pi@HIDDEN>) id 1hZskn-0001XG-QF
 for bug-grep@HIDDEN; Sun, 09 Jun 2019 04:00:38 -0400
Received: from localhost ([151.15.190.244]) by smtp-36.iol.local with ESMTPA
 id Zskihv3g5GqCXZskihWEr1; Sun, 09 Jun 2019 10:00:33 +0200
x-libjamoibt: 1601
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2014;
 t=1560067235; bh=EvO9LLiSiuysn1kOtgGCjdtZoOm+/O2/4ZuJB9wQwLQ=;
 h=Date:From:To:Subject;
 b=PEz19Moxv242HiAoMWxVVCas52bIY9fxtlFGy4VwBHJgKTGXsJU33vZ2rxza0kS48
 VdIprLIftV7CC2E7mrLrlxHOU9M1K6t2RsQmXnQatpUEOJzN7PG2de2atsQU0Z5v6C
 Mv9c+qQAanSa2fk3/aT2ZCpzT4a270ab/wAKlE3a0V8wV7ddCX3ZQTfTzzEer4EuIi
 LP92AXyQQZF2rf6hcHiiC7cTHnmzLwARTjCDCwrUA4vQJlRyzHkSKENUAgYGSR7qhX
 LHszPSXK06RLsb86GbWrxux9zk1NSga8LSo5wXDrUYghoYa2X7a3/COLk2f1Ax5QeC
 WYcmg5ZXP3R1A==
X-CNFS-Analysis: v=2.3 cv=IofPj43g c=1 sm=1 tr=0
 a=XzvzAlnx5skC+0spddO+ig==:117 a=XzvzAlnx5skC+0spddO+ig==:17
 a=kj9zAlcOel0A:10 a=4TDtqyubXOBDjDHEGnMA:9 a=CjuIK1q_8ugA:10
Date: Sun, 9 Jun 2019 10:00:24 +0200
From: g1pi@HIDDEN
To: bug-grep@HIDDEN
Subject: inconsistent behaviour with anchored regex containing back-references
Message-ID: <20190609080024.sywtiytvlajpd4ko@moon>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: NeoMutt/20170113 (1.7.2)
X-CMAE-Envelope: MS4wfIHarwt+9ZFwfqtR4uprOd4gs68SFi4Ny9QRG1tUgtM+DfFS5SPcAuntZGdSlEKDTosd1pNvbsPOzUKwnv7h3m9lsHYFCRMNX1qt9RZoiZeLPtJ/wZpX
 W82IHsDO0bu5UJrK//L9WcTwBA7qUQVOvpCz3lln5hSP1goO50KBIVB9FHBH+16hrzdTbsKTmswu6w==
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 213.209.10.36
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 09 Jun 2019 11:29:20 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

There seems to be a problem with beginning/end-of-line anchors in regex
containing back-references:

$ grep -V | head -1
grep (GNU grep) 3.1

$ cat words
ana
deed
ill
stats

Using -x to match whole line works:

$ egrep -x '(.?)(.?).?\2\1' words 
ana
deed
stats

Using explicit anchors emits false positives:

$ egrep   '^(.?)(.?).?\2\1$' words 
ana
deed
ill	<<<
stats

On the other hand, colouring the output shows that grep somewhat knows its
mistake:

$ egrep --color '^(.?)(.?).?\2\1$' words 
ana	(coloured)
deed	(coloured)
ill
stats	(coloured)





Acknowledgement sent to g1pi@HIDDEN:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#36148; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 2 Jan 2020 09:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.