GNU bug report logs - #60621
grep -P does not set PCRE2_UCP

Previous Next

Package: grep;

Reported by: Karl Pettersson <karl.pettersson <at> klpn.se>

Date: Sat, 7 Jan 2023 07:38:03 UTC

Severity: normal

Merged with 60618

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Karl Pettersson <karl.pettersson <at> klpn.se>
To: 60621 <at> debbugs.gnu.org
Subject: bug#60621: grep -P does not set PCRE2_UCP
Date: Fri, 6 Jan 2023 21:41:53 +0100
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/




This bug report was last modified 2 years and 187 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.