git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] grep: correctly identify utf-8 characters with \{b,w} in -P

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 17, 2023, 15:19 UTC
Message-ID
<xmqqr0vt9oj9.fsf@gitster.g>
In-Reply-To
<230117.865yd5z4ke.gmgdl@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> To argue with myself here, I'm not so sure that just making this the
> default isn't the right move, especially as the GNU grep maintainer
> seems to be convinced that that's the right thing for grep(1).
OK.
Show 22 quoted lines
> I think calling this e.g.:
>
> 	grep.perl.Unicode=<bool>
> 	grep.patternTypePerl.Unicode=<bool>
>
> Or even:
>
> 	grep.patternTypePerl.Flags=u
>
> Would be better, i.e. PCRE's C API is really just mapping to the flags
> you can find in "perldoc perlre" (https://perldoc.perl.org/perlre). In
> this case the /u flag maps to the "PCRE2_UCP" API flag.
>
> That we happen to use PCRE to give ourselves "Perl" semantics is an
> implementation detail we should avoid exposing, so we could either give
> our config generic names, or literally map to the perl /flags/.
>
> For now we could just die on any "Flags" value that isn't "u".
>
> Of course all of this is predicated on us wanting to leave this as an
> opt-in, which I'm not so sure about. If it's opt-out we'll avoid this
> entire question,

Making it opt-out would also require a similar knob to turn the "flag" off, be it a configuration variable or a command line option, wouldn't it? I tend to agree with you that it makes sense to make it a goal to take us closer to "grep -P" from GNU---do they have such an opt-out knob? If not, let's make it simple by turning it always on, which would be the simplest ;-)

Again, thanks for a careful review with concrete points.
Previous: Ævar Arnfjörð BjarmasonNext: Carlo Arenas
Message 12 of 17 in “grep: correctly identify utf-8 characters with \{b,w} in -P”
  1. grep: correctly identify utf-8 characters with \{b,w} in -PCarlo Marcelo Arenas Belón, Jan 8, 2023
  2. Junio C HamanoJan 8, 2023
  3. grep: correctly identify utf-8 characters with \{b,w} in -PCarlo Marcelo Arenas Belón, Jan 8, 2023
  4. Ævar Arnfjörð BjarmasonJan 9, 2023
  5. Paul EggertJan 9, 2023
  6. Ævar Arnfjörð BjarmasonJan 9, 2023
  7. Paul EggertJan 9, 2023
  8. Carlo ArenasJan 10, 2023
  9. Junio C HamanoJan 16, 2023
  10. grep: correctly identify utf-8 characters with \{b,w} in -PCarlo Marcelo Arenas Belón, Jan 17, 2023
  11. Ævar Arnfjörð BjarmasonJan 17, 2023
  12. Junio C HamanoJan 17, 2023
  13. Carlo ArenasJan 18, 2023
  14. Ævar Arnfjörð BjarmasonJan 18, 2023
  15. Junio C HamanoJan 18, 2023
  16. Ævar Arnfjörð BjarmasonJan 18, 2023
  17. Junio C HamanoJan 18, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.