public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx•de>
To: Junio C Hamano <gitster@pobox•com>
Cc: git@vger•kernel.org, "René Scharfe" <l.s.r@web•de>
Subject: Re: [PATCH] regex: not all macOS platforms seem to have REG_ENHANCED
Date: Fri, 20 Mar 2026 09:06:23 +0100 (CET)	[thread overview]
Message-ID: <77b6ec9f-46a5-1f38-9733-188e20da55ec@gmx.de> (raw)
In-Reply-To: <6636e7d2-7a1d-0108-2e62-af27a3ae3cf3@gmx.de>

Me again,

On Fri, 20 Mar 2026, Johannes Schindelin wrote:

> On Fri, 20 Mar 2026, Junio C Hamano wrote:
> 
> > 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.

Ah. That flag _is_ the reason for the build error: I misunderstood what it
is about. It is not telling the build process to compile with
`compat/regex.c` and using enhanced regexes, it is telling the build
process that whatever regex library is used _does_ support them.

So I need to pivot and recommend something like this in the `Darwin`
clause in `config.mak.uname`:

-- snipsnap --
diff --git a/config.mak.uname b/config.mak.uname
index f9ffefa67a4f..572f8967bc36 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -172,6 +172,10 @@ ifeq ($(uname_S),Darwin)
 		NEEDS_GOOD_LIBICONV = UnfortunatelyYes
         endif
 
+	ifeq ($(CC),clang)
+		NO_REGEX = HomebrewsClangSeemsToBeMissingEnhancedRegexSupportAsOfMarch2026
+	endif
+
 	# The builtin FSMonitor on MacOS builds upon Simple-IPC.  Both require
 	# Unix domain sockets and PThreads.
         ifndef NO_PTHREADS

  reply	other threads:[~2026-03-20  8:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 22:37 [PATCH] regex: not all macOS platforms seem to have REG_ENHANCED Junio C Hamano
2026-03-19 23:11 ` René Scharfe
2026-03-20  1:30   ` Junio C Hamano
2026-03-20  7:34     ` Johannes Schindelin
2026-03-20  7:48       ` Johannes Schindelin
2026-03-20  7:55 ` Johannes Schindelin
2026-03-20  8:06   ` Johannes Schindelin [this message]
2026-03-20  8:55     ` Johannes Schindelin
2026-03-20 11:12       ` René Scharfe
2026-03-20 15:12         ` Johannes Schindelin
2026-03-20 15:59           ` René Scharfe
2026-03-20 16:33         ` Junio C Hamano
2026-03-20 16:57       ` Junio C Hamano
2026-03-20 16:50   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77b6ec9f-46a5-1f38-9733-188e20da55ec@gmx.de \
    --to=johannes.schindelin@gmx$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=l.s.r@web$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox