Subject: bug#21670: surprising bug in grep -e with anchors

From: Jim Meyering <[email-masked]>
Date: Mon, 12 Oct 2015 09:28:03 -0700

On Sun, Oct 11, 2015 at 2:01 PM, greg boyd <[email-masked]> wrote:
> This bug appears in GNU grep version 2.20. It is not present in the older
> version I have installed on a home system (2.6.3.)
>
> test case (single line)
> abchelloabc
>
> grep does not find the line with grep -e '^hello'  nor with grep -e 'hello$'
> however, the line is output with
> grep -e '^hello' -e 'hello$'
>
> I downloaded, built and tested the bug on GNU grep 2.21 and it still
> appears.

Thank you for the report.
I confirm that it affects grep-2.21 with this:

  $ echo axa |/p/p/grep-2.21/bin/grep -E '^x|x$'
  axa

However, it appears to be fixed in the version built
from the latest sources, yet there is no mention in NEWS.

The actual bug was introduced in v2.18-85-g2c94326,
so first appeared in the grep-2.19 release. I will track down
the commit that fixed it, add a test if required and update
NEWS accordingly.

With this, I will prioritize making a new release soon.