Subject: bug#33062: grep matches too lazily when invoked with -zoP and matching backreference followed by newline

From: Johannes Riecken <[email-masked]>
Date: Tue, 16 Oct 2018 14:55:34 +0200

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