Subject: bug#25655: grep-2.28 is broken with multiple -e patterns

From: Lars Wendler <[email-masked]>
Date: Wed, 8 Feb 2017 20:49:35 +0100

Hi,

we got a bug report a Gentoo [1] that grep-2.28 is broken when
searching for multiple patterns with -e:

grep-2.27:

  % echo ".tar" | grep -e "\.tar"; echo $?           
  .tar
  0

  % echo ".tar" | grep -e "\.tar" -e "\.tbz"; echo $?
  .tar
  0

grep-2.28:

   % echo ".tar" | grep -e "\.tar"; echo $?           
   .tar
   0

   % echo ".tar" | grep -e "\.tar" -e "\.tbz"; echo $?
   1

But this seems to be not the only issue:

echo "atbz" | grep -e "\.tar" -e ".tbz"

is matching "atbz"

echo ".tbz" | grep -e "\.tar" -e ".tbz"

matches ".tbz"

but

echo ".tar" | grep -e "\.tar" -e "tar"

only matches "ta".

We've identified commit 290ca116c9172d97b2b026951fac722d3bd3ced9 as the
one that introduced this regression

Kind regards
Lars

[1] https://bugs.gentoo.org/608644

-- 
Lars Wendler
Gentoo package maintainer
GPG: 21CC CF02 4586 0A07 ED93  9F68 498F E765 960E 9B39

Attention! New gpg key! See
https://www.gentoofan.org/blog/index.php?/archives/9-New-gpg-keys.html