Subject: bug#51235: resolve old FIXME in PCRE implementation to allow more than 1 expression

From: Carlo Arenas <[email-masked]>
Date: Sat, 16 Oct 2021 01:58:29 -0700

On Sat, Oct 16, 2021 at 12:50 AM Paul Eggert <[email-masked]> wrote:
>
> On 10/16/21 12:00 AM, Carlo Arenas wrote:
> > With this patch, multiple expressions (from -e or -f) are now
> > acceptable with -P for easier side by side comparison with the other
> > supported engines.
>
> Surely this mishandles shell commands like this one:
>
> grep -P '[
> a]'
>
> which should be an error, but with that patch would not be an error.

of course, but ironically without the patch, the error isn't correct either:

$ grep -P '[
> a]'
grep: the -P option only supports a single pattern

I would say that for a 4 line patch with negative byte count, it is
worth the trade.
But if you feel so strongly against it, doing the one that compiles
every line independently and that will catch that problem wouldn't be
that difficult, but I would rather do it as a follow up, and is
definitely going to be bigger.

Carlo