Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > On Thu, Jan 12 2023, Jeff King wrote: > >> So it does seem like all bets are off for what people can and should >> expect here. Which isn't to say we should make things worse. I mostly >> wondered if REG_ENHANCED might take us closer to what glibc was doing by >> default, but it doesn't seem like it. I thought that René's "Use enhanced only when doing BRE" was fairly focused, but I am very tempted to accept ... > There's a couple of ways out of this that I don't see in this thread: > > - Declare it not a problem: We have -G, -E and -P to map to BRE, ERE and > PCRE. One view is to say the first two must match POSIX, another is > tha whatever the platform thinks they should do is how they should > act. ... this view. The story "BRE and ERE work via what system libraries provide, and 'git grep' matches what system grep' does" is an easy to understand view. > - Just mandate PCRE for Mac OS, then map -E to -P. We could do this with > the pcre2convert() API and PCRE2_CONVERT_POSIX_EXTENDED flag, > i.e. PCRE's own "translate this to ERE". Presumably this is to ensure -E works identically everywhere? If so, then we should do that everywhere, not just on macOS. But again it makes "git grep -E" slightly incompatible with "grep" on systems (including macOS), so...