GNU bug report logs -
#60618
unicode characters are not identified as such for \w and \b with -P
Previous Next
Reported by: Carlo Arenas <carenas <at> gmail.com>
Date: Sat, 7 Jan 2023 03:49:01 UTC
Severity: normal
Merged with 60621
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sat, 7 Jan 2023 18:28:49 -0800
with message-id <CA+8g5KFxt_SKL=tMPbRMnZhojv522x--OY-iq4k0SQpuTcfuQQ <at> mail.gmail.com>
and subject line Re: bug#60618: unicode characters are not identified as such for \w and \b with -P
has caused the debbugs.gnu.org bug report #60618,
regarding grep -P does not set PCRE2_UCP
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
60618: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60618
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Hi
Using grep -P for boundary matches yields incorrect results with
non-ASCII letters:
$ echo 'Öst' | grep -P '\bs'
Öst
The output should be nothing in this case, and the culprit seems to be
this line in pcresearch.c:
flags |= PCRE2_UTF;
If the PCRE2_UCP flag is added according to this, the program behaves
correctly:
flags |= PCRE2_UTF|PCRE2_UCP;
The pcre2grep test program in the pcre2 has the same problem, and I
filed an issue there too:
https://github.com/PCRE2Project/pcre2/issues/185
A Twitter discussion with more examples:
https://twitter.com/gro_tsen/status/1610972356972875777
Kind regards
--
Karl Pettersson
Uppsala, Sverige/Sweden
https://static-dust.klpn.se/
[Message part 3 (message/rfc822, inline)]
On Fri, Jan 6, 2023 at 11:37 PM Jim Meyering <jim <at> meyering.net> wrote:
> On Fri, Jan 6, 2023 at 11:28 PM Jim Meyering <jim <at> meyering.net> wrote:
> > On Fri, Jan 6, 2023 at 7:49 PM Carlo Arenas <carenas <at> gmail.com> wrote:
> > > Reported to PCRE[1] with mention of GNU grep being also affected.
> > >
> > > [1] https://github.com/PCRE2Project/pcre2/issues/185
> >
> > Yikes. This is a big deal.
> > Thank you for the patch and added test.
I've also added the new names to THANKS.in and pushed this:
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=5e3b760f65f13856e5717e5b9d935f5b4a615be3
This bug report was last modified 2 years and 131 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.