git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:58 UTC

Re: [PATCH] regex: not all macOS platforms seem to have REG_ENHANCED

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 20, 2026, 07:55 UTC
Message-ID
<6636e7d2-7a1d-0108-2e62-af27a3ae3cf3@gmx.de>
In-Reply-To
<xmqq8qbnigxp.fsf@gitster.g>
Hi Junio,
On Fri, 20 Mar 2026, Junio C Hamano wrote:
Show 23 quoted lines
> Earlier, 54463d32 (use enhanced basic regular expressions on macOS,
> 2023-01-08) started to use the REG_ENHANCED option when ERE is not
> in use on macOS.  The build seems to have started failing on
> macos-14 CI jobs at GitHub, however, as apparently not all the macOS
> platforms have this flag defined.
> 
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  compat/regcomp_enhanced.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/compat/regcomp_enhanced.c b/compat/regcomp_enhanced.c
> index 84193ce53b..51e1358170 100644
> --- a/compat/regcomp_enhanced.c
> +++ b/compat/regcomp_enhanced.c
> @@ -3,7 +3,9 @@
>  
>  int git_regcomp(regex_t *preg, const char *pattern, int cflags)
>  {
> +#ifdef REG_ENHANCED
>  	if (!(cflags & REG_EXTENDED))
>  		cflags |= REG_ENHANCED;
> +#endif

While this lets the build pass, it _does_ change behavior. Where previously, EREs were enforced, now BREs are silently enforced.

So it might be desirable to instead imitate what `meson.build` does, namely define `USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS` on macOS when compiling with `clang`.

But that should already be the case: https://gitlab.com/git-scm/git/-/blob/v2.53.0/config.mak.uname#L151

> ifeq ($(uname_S),Darwin)
> [...]
> 	USE_ENHANCED_BASIC_REGULAR_EXPRESSIONS = YesPlease
So: hmm.

Ciao, Johannes

Show 7 quoted lines
>  	return regcomp(preg, pattern, cflags);
>  }
> -- 
> 2.53.0-816-g44373249a2
> 
> 
> 
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 6 of 14 in “regex: not all macOS platforms seem to have REG_ENHANCED”
  1. regex: not all macOS platforms seem to have REG_ENHANCEDJunio C Hamano, Mar 19, 2026
  2. René ScharfeMar 19, 2026
  3. Junio C HamanoMar 20, 2026
  4. Johannes SchindelinMar 20, 2026
  5. Johannes SchindelinMar 20, 2026
  6. Johannes SchindelinMar 20, 2026
  7. Johannes SchindelinMar 20, 2026
  8. Johannes SchindelinMar 20, 2026
  9. René ScharfeMar 20, 2026
  10. Johannes SchindelinMar 20, 2026
  11. René ScharfeMar 20, 2026
  12. Junio C HamanoMar 20, 2026
  13. Junio C HamanoMar 20, 2026
  14. Junio C HamanoMar 20, 2026

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.