GNU bug report logs - #33062
grep matches too lazily when invoked with -zoP and matching backreference followed by newline

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: Johannes Riecken <johannes.riecken@HIDDEN>; dated Tue, 16 Oct 2018 14:42:02 UTC; Maintainer for grep is bug-grep@HIDDEN.
bug reassigned from package 'coreutils' to 'grep'. Request was from Bernhard Voelker <mail@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 33062) by debbugs.gnu.org; 23 Oct 2018 23:17:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 23 19:17:08 2018
Received: from localhost ([127.0.0.1]:38907 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gF5v9-0001Hc-UH
	for submit <at> debbugs.gnu.org; Tue, 23 Oct 2018 19:17:08 -0400
Received: from mout.kundenserver.de ([217.72.192.75]:42537)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>)
 id 1gF5v7-0001Ba-UP; Tue, 23 Oct 2018 19:17:06 -0400
Received: from [192.168.101.10] ([91.12.166.119]) by mrelayeu.kundenserver.de
 (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id
 1MpUMc-1fpdWY1dk4-00puJh; Wed, 24 Oct 2018 01:16:58 +0200
Received: from [192.168.101.10] ([91.12.166.119]) by mrelayeu.kundenserver.de
 (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id
 1MpUMc-1fpdWY1dk4-00puJh; Wed, 24 Oct 2018 01:16:58 +0200
Subject: Re: bug#33062: grep matches too lazily when invoked with -zoP and
 matching backreference followed by newline
To: Johannes Riecken <johannes.riecken@HIDDEN>, 33062 <at> debbugs.gnu.org
References: <CAP9p3fEApD4rQXD_tjqHt8bvbP+QxM1epDFq9S+kmTknjiQnHA@HIDDEN>
From: Bernhard Voelker <mail@HIDDEN>
Openpgp: preference=signencrypt
Autocrypt: addr=mail@HIDDEN; prefer-encrypt=mutual; keydata=
 xsBNBFPirzMBCACyzYldTjQ4ufFOkByY5Nn5USb5GFoL48nWBwNHjd9KUbtRRNlQiPNKd6hK
 Gvd3BGi5aoFKA4ytfRk6jbAbW3jVb3R8wYaV08mOy4KVEKxqN4bxsXlMjNChXVR+rtKDmfI+
 oPTL+cPH2X6gW4W02IRbVw0uUhNm6zEedC/gNrY/mTlf1enZ46jxZ7BTUZaG+kx38UMISIMB
 zSzLRtdkwgmHj4jS3p1fF2cwRqLclIfMjKGpbNFPEXeXKWrCLcqHw78795eAR9q0YvrDkfIn
 GdDBwfb3VM4NdulwIFzvYZMSXvSbbyPLB5YkHU5aAWQHUse4WlfT5ccDpbzUYldRAvF9ABEB
 AAHNK0Jlcm5oYXJkIFZvZWxrZXIgPG1haWxAYmVybmhhcmQtdm9lbGtlci5kZT7CwHkEEwEC
 ACMFAlPirzMCGwMHCwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRBGUC73lpFxle5wCACC
 dbs0QaJ0vR3Sff2cKdTk41rUq3YfWngsR///IOU0C5DdkePmCnJE/lUsUy0LRTxcUDLxQR+x
 QHU8ssRT0JUO9726dI3miy36UdsgmBYaOtLvQcidGmW1R7o0PYYf04+TFtyqKgngOUBPpMgR
 6o4UsQxy/OD4bN1WDqOgIjL+D/qJpkKmgp6L6+hhaBCpiOFKRmmV7YyQ3SqVlfQNiHs5ZtkR
 nXpIjgZARV+GllKucI17bO0CGmTJZ1tstVy0+W3DQT1lbBkTTc++5LONM99D3jjn23l1ocOp
 folR53F7I4cb2RNfT23v1I59RH37lB9wMOqrKj0UjYAC2YoPGQ3BzsBNBFPirzMBCADXLWWp
 QihBldY6reca8ZKdc3T9qXEOa3akE3DWKztIBmNJhtYOjmpLYajQTkGa7UoJTnbmZE2Rn6ZE
 oNnvb0gcFNAIcY95KOI+bjOR8HEgh4cx2REXh6L6olIgyXqt/KFusE4wtVZAFxZl+30HzN6n
 D+1HvrjXxPJRX6MsIYOYyyX9/6OofwJK6QHODYGp8WL2olHDnmsXg4AT6Wlr7qKpKrQELlcF
 R4xkvdmgL/Ghw/tK0yJTxMIcewCCZWLPOXRmFRbvAadZWPAgVsJ63siNyUlVnVMSzDgTJl+s
 l/DMabXpqrJQx3/1Yy6mTaDs3XZT/wmBKaTLXx/LByaPxQQ7ABEBAAHCwF8EGAECAAkFAlPi
 rzMCGwwACgkQRlAu95aRcZWVPwgAqZT6iTXkoP37wYb41323RzhBcJ8JSk4cyBDBUXX0lMrM
 3qhiClKG7phpxVdu817Gwc6Hsecg7FfjQAV8MHQ0ZFeEFdk3b2rKBqfsStc+h49/xF3Fb+if
 CzR9qeQF82fMSxkg18++7hMcHCMO/hPZ/Q0xRi+lrSr2QKDJQuLzSyVU14TxrCkevZjEhtma
 VNvcJlJzCbiBXee9Fpc5jITUXPFG8E8dxqo1n+duOyIMgozrAnzP7X5V/Ob/Ozf/aGGX9+Jd
 inyfCX18nWcHALKMU/36Eua/ylalf/2c2YkBp9KCLVmGgPkUgW52EeRPgroIsiwu+rwCSV6Z
 UyCJ+OymCg==
Message-ID: <a73342bf-f807-32ae-bb67-de2ed8d2bd40@HIDDEN>
Date: Wed, 24 Oct 2018 01:16:57 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.2.1
MIME-Version: 1.0
In-Reply-To: <CAP9p3fEApD4rQXD_tjqHt8bvbP+QxM1epDFq9S+kmTknjiQnHA@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Provags-ID: V03:K1:eSeQ7UwXHq6t9ONYL2IrgUrNF59og8nlGn+zwEf7TgJ4Mdu8Ija
 DJR04jHQfuTD54884m/glxCTqPF/J6XhC6WZPDM4FFfo+Uy6//4Qy2zigR2Ru/JgWYPgr/V
 hxAOqAMejtGCTj9BygSrjDQWXnb9g6zNoYSXP+v7Pc/jS6tJyI4o8Uikj/cVI6IrXq8vue+
 U1UDvNAQLueeeQOf0uTxA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V01:K0:RNXNmvp7XmY=:TtqnYXfZXZ53ZgWZ2TXgH1
 k13zGFOXOXby54ehs08aH0O9ah4jD6C/dX/hkslKAh1ZdfQvAyCM7m2IfQS9fPzaqzuuvcgGJ
 EjloeSfNGDPxuwxAEx/cM+ocbmDX9NQJsMpFu7Gq8rb77Gfio19YVO9zPbgPP86GMC0px7Hg1
 M9qP0h2UnowTA4PqlPb4mfoEkwCBBRbikLitHWLlLBKbe4KK2L0iZ899/DikIMaEz6QX7KBn3
 dAhs5T+MbQfo6VxJk0ZRyGw61hWOYih+o5CZ7PhwE10vlMdy9+V1m6IDqUDaD9X2avWWs87nG
 QJqvqOb8vk2FJ4v5qiskgAnfLbByrhQT4C79rBj6kP63AEqjiZsr9jwHw3VRJdFt263UqBjol
 xjp3Xpx02l1dWy6FiLX9fYptk8nsi9oq1KlK67REabUQxyiq4sBFv4tB+zA1E8iWv9KoPLD4F
 YI7P/w6BY6B9cThbU89P4trURO4UNLzggMneMQzs4TIelpk0ulY/gKZ58mFMlskzBGh0pp3RF
 VGy6t5Rq7HNX7wQ7EJxTde1wJa90LBvXcSrRHQ9nLRn4WWCMNsIgbkcSMsdobiY1loLOZPbaV
 635muqaCPTxFJQ6PHnJARVbtmyg8zLgUgMVOvGVpMa3RTg4lMIlsO+8M+Apr1VexfGDrr6Vrg
 DRRheM919SK3jctNj+gL5bWvs01sKTv/1ERY/4qJW81dSgJO1YKDe2zjDc1Pvx6dKNLMpe7f1
 Qn5BTwhfFq80tn0a
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 33062
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

reassign 33062 grep
stop

On 10/16/18 2:55 PM, Johannes Riecken wrote:
> Dear maintainers:
> 
> *Bug summary: *GNU grep 3.0-2 matches too lazily when invoked with -zoP and
> matching backreference followed by newline
> 
> *Steps to reproduce:*
> 
> Create file cases:
> 
> foo
> bar
>   cases:
>     1: foo
>     2: bar
> baz
>   cases:
>     3: baz
> quux
> 
> And run grep -zoP '(\s*)cases:\n(\1.*\n)*' cases
> 
> *Expected output:*
> 
>   cases:
>     1: foo
>     2: bar
>   cases:
>     3: baz
> 
> * Actual output:*
> 
>   cases:
> 
>   cases:
> 
> Best regards,
> 
> Johannes Riecken

Thanks for the report, however, you reached the GNU coreutils mailing list,
while your report is for 'grep'.

I'm therefore reassigning this issue to the GNU 'grep' package.

Have a nice day,
Berny





Information forwarded to bug-coreutils@HIDDEN:
bug#33062; Package coreutils. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 16 Oct 2018 14:41:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 16 10:41:17 2018
Received: from localhost ([127.0.0.1]:53798 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1gCQX6-0006ti-SZ
	for submit <at> debbugs.gnu.org; Tue, 16 Oct 2018 10:41:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:39438)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <johannes.riecken@HIDDEN>) id 1gCOtD-0003tA-Qi
 for submit <at> debbugs.gnu.org; Tue, 16 Oct 2018 08:56:00 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <johannes.riecken@HIDDEN>) id 1gCOt7-0000ki-MO
 for submit <at> debbugs.gnu.org; Tue, 16 Oct 2018 08:55:54 -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.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,
 HTML_MESSAGE autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:58157)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <johannes.riecken@HIDDEN>)
 id 1gCOt7-0000kZ-FF
 for submit <at> debbugs.gnu.org; Tue, 16 Oct 2018 08:55:53 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:49040)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <johannes.riecken@HIDDEN>) id 1gCOt6-0002LT-NF
 for bug-coreutils@HIDDEN; Tue, 16 Oct 2018 08:55:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <johannes.riecken@HIDDEN>) id 1gCOt4-0000il-LB
 for bug-coreutils@HIDDEN; Tue, 16 Oct 2018 08:55:52 -0400
Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]:36222)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <johannes.riecken@HIDDEN>)
 id 1gCOt2-0000ee-OG
 for bug-coreutils@HIDDEN; Tue, 16 Oct 2018 08:55:49 -0400
Received: by mail-ot1-x330.google.com with SMTP id x4so20974684otg.3
 for <bug-coreutils@HIDDEN>; Tue, 16 Oct 2018 05:55:44 -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=pDJDCO4kRTYafVc+8JOvJJH5jSq014WOWyfMOKQj5LQ=;
 b=IIoskijtr4Cm8eUca/Wwa8WsJH/fYFanYfkQxxin7slSxDgJYBueNGCpFZX9Zo4cW6
 zVp0KP6arI0AWbJh/aMp4jF21rAl8GnqArUSrbixB36s4fNyg3ZBkjlQGqEIoBPZ1l6j
 ZbQKE2y5aw2aHuarW4RdAsQYyG1EoZg1IH4MqFXPhPqCMWWfyANMzeHqQq/M6CBMxF/P
 JUuqmE7Ssig2XA+hmYSeX/0r39/+fJUsi4gDZNYmUcmjOauZQcd1hvNBFK0l0HAOdRYj
 Bh/wqnShRiiW/qREh6p3Zn13feJ/51cQikR34riPoCcKgWIAwBC/qYAl3Y/elyc8VAvw
 eaLQ==
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=pDJDCO4kRTYafVc+8JOvJJH5jSq014WOWyfMOKQj5LQ=;
 b=ilj2fzd3VDOBxHyJu8vmu2ZvGhRJRMAxKdzlmaAAKsUYujUBitSlhn1DxsDXze9Bqf
 8q2Iq2XXsW6i2/UPfIKYBEI68GWpwITLNmS4xLuVwTeIb8TwecTTwgpzVzCgSMkzNFUE
 sLuwf9P3h+qbzEOk6LmDT+CIFjalwHLReOzwuaMgPv28j006EfCdfQZwmvXz8s2PQT/1
 4l6h7PMRHBdKMfpZkH3yh5S2AzVvJ67OGSwr88Z/TycQBIt6PRMKprvwDyKGl1xh0mR3
 bFKnu3a4606nyv+/3KnT7i77lDw8wmgFDlfxVXlDC1KyA0bpcRsmVu4aAoiNE1a199Mb
 xZZA==
X-Gm-Message-State: ABuFfoh+0DEfj3gV0ups4DhFLG83j3D9Fs6th3KuX4pxWxUDAkeQZc9Q
 0+jQZjeRsgc9OJlWy0pEgGqsG3IWjMStWzcmXYRRjKDrvFE=
X-Google-Smtp-Source: ACcGV62+5RXrzS71scbYOpQMs4VQyHyHmAb4eT4ja0iICB4ch/mS9Ksp0PSKLxavk8BcvdcKqH12k7cn2vmg3zSDudA=
X-Received: by 2002:a9d:24c7:: with SMTP id z65mr13480239ota.229.1539694544018; 
 Tue, 16 Oct 2018 05:55:44 -0700 (PDT)
MIME-Version: 1.0
From: Johannes Riecken <johannes.riecken@HIDDEN>
Date: Tue, 16 Oct 2018 14:55:34 +0200
Message-ID: <CAP9p3fEApD4rQXD_tjqHt8bvbP+QxM1epDFq9S+kmTknjiQnHA@HIDDEN>
Subject: grep matches too lazily when invoked with -zoP and matching
 backreference followed by newline
To: bug-coreutils@HIDDEN
Content-Type: multipart/alternative; boundary="0000000000005be2a9057858121c"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 16 Oct 2018 10:41:15 -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: -5.0 (-----)

--0000000000005be2a9057858121c
Content-Type: text/plain; charset="UTF-8"

Dear maintainers:

*Bug summary: *GNU grep 3.0-2 matches too lazily when invoked with -zoP and
matching backreference followed by newline

*Steps to reproduce:*

Create file cases:

foo
bar
  cases:
    1: foo
    2: bar
baz
  cases:
    3: baz
quux

And run grep -zoP '(\s*)cases:\n(\1.*\n)*' cases

*Expected output:*

  cases:
    1: foo
    2: bar
  cases:
    3: baz

* Actual output:*

  cases:

  cases:

Best regards,

Johannes Riecken

--0000000000005be2a9057858121c
Content-Type: text/html; charset="UTF-8"

<div dir="ltr"><div dir="ltr"><div>Dear maintainers:</div><div></div><div>
<p><b>Bug summary: </b>GNU grep 3.0-2 matches too lazily when invoked with -zoP and matching backreference followed by newline</p><p><b>Steps to reproduce:</b><br></p><p>Create file <code>cases</code>:</p>

<pre class="gmail-default gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pln">foo
bar
  cases</span><span class="gmail-pun">:</span><span class="gmail-pln">
    </span><span class="gmail-lit">1</span><span class="gmail-pun">:</span><span class="gmail-pln"> foo
    </span><span class="gmail-lit">2</span><span class="gmail-pun">:</span><span class="gmail-pln"> bar
baz
  cases</span><span class="gmail-pun">:</span><span class="gmail-pln">
    </span><span class="gmail-lit">3</span><span class="gmail-pun">:</span><span class="gmail-pln"> baz
quux</span></code></pre>

<p>And run<code> grep -zoP &#39;(\s*)cases:\n(\1.*\n)*&#39; cases</code> <br></p><p><b>Expected output:</b><br></p>

<pre class="gmail-default gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pln"><code><span class="gmail-pln">  cases</span><span class="gmail-pun">:</span><span class="gmail-pln">
    </span><span class="gmail-lit">1</span><span class="gmail-pun">:</span><span class="gmail-pln"> foo
    </span><span class="gmail-lit">2</span><span class="gmail-pun">:</span><span class="gmail-pln"> bar
  cases</span><span class="gmail-pun">:</span><span class="gmail-pln">
    </span><span class="gmail-lit">3</span><span class="gmail-pun">:</span><span class="gmail-pln"> baz</span></code>

</span></code></pre><b>

Actual output:</b><br><pre class="gmail-default gmail-prettyprint gmail-prettyprinted"><code><span class="gmail-pln">  cases</span><span class="gmail-pun">:</span><span class="gmail-pln">

  cases</span><span class="gmail-pun">:</span></code></pre>Best regards,</div><div><br></div><div>Johannes Riecken<br></div></div></div>

--0000000000005be2a9057858121c--




Acknowledgement sent to Johannes Riecken <johannes.riecken@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#33062; Package coreutils. 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: Tue, 23 Oct 2018 23:30:02 UTC

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