Subject: bug#43527: [PATCH] grep: avoid unneeded compilation of regex

From: Jim Meyering <[email-masked]>
Date: Wed, 23 Sep 2020 20:00:11 -0700

On Tue, Sep 22, 2020 at 8:04 PM Norihiro Tanaka <[email-masked]> wrote:
> On Tue, 22 Sep 2020 16:25:06 -0700
> Jim Meyering <[email-masked]> wrote:
>
> > Oh! Good timing. I was about to make a new snapshot.
> > Do you happen to have a test case handy that demonstrates the failure?
>
> I added test case to previous patch.

Thank you, I expect to push it shortly, along with a gnulib-sync diff,
to pull in Paul's regex fixes.

> By the way, I found the following bug in making the test case, and it's
> still left.
>
> $ env LC_ALL=tr_TR.utf8 grep -Fio i in
> Aborted (core dumped)
>
> (gdb) bt
> #0  0x0000003b8d032495 in raise () from /lib64/libc.so.6
> #1  0x0000003b8d033c75 in abort () from /lib64/libc.so.6
> #2  0x000000000040cdde in kwsinit (mb_trans=true) at searchutils.c:64
> #3  0x0000000000409624 in Fcompile (pattern=0x23c1240 "i\n", size=1, ignored=0, exact=true) at kwsearch.c:56
> #4  0x0000000000409378 in main (argc=4, argv=0x7ffe76048388) at grep.c:2977

Please tell us what is in your input file named "in" and what type of
system you're using.
If I guess it's the "in" file from the turkish-eyes test, and try the
following (using both your and Paul's patches), I see no failure:

$ i=$(printf '\304\261') I=$(printf '\304\260'); data="I:$I $i:i";
echo "$data" > in; env LC_ALL=tr_TR.utf8 src/grep -Fio i in
İ
i