Re: git bug: Perl compatible regular expressions do not work as expected
- From
René Scharfe <l.s.r@web.de>
- Date
- Mar 27, 2023, 17:23 UTC
- Message-ID
- <03fd7ddb-8241-1a0a-3e82-d8083e4ce0f7@web.de>
- In-Reply-To
- <xmqqh6u6cg4l.fsf@gitster.g>
Am 27.03.23 um 18:29 schrieb Junio C Hamano:
Show 11 quoted lines
> René Scharfe <l.s.r@web.de> writes: > >> Or to enable REG_ENHANCED >> for them, at least, like 54463d32ef (use enhanced basic regular >> expressions on macOS, 2023-01-08) did to get alternations for git grep >> on macOS. > > This one sounds like a reasonable thing, which may not have huge > unintended fallout, to do. I am a bit surprised that we have to > cover each individual callsite of regcomp(3), though. Doesn't the > 54463d32ef fix use "#define regcomp git_regcomp" to cover everybody?
54463d32ef only affects basic regular expressions (BRE), but -G and -S use extended ones (ERE). macOS allows both to be "enhanced".
I have a hard time finding a readable reference to the documentation to brings us all onto the same page regarding what REG_ENHANCED actually does. [1] is in raw troff format, [2] isn't very pretty and shows ads. Anyway, the rather lengthy section "ENHANCED FEATURES" explains it.
René
[1] https://opensource.apple.com/source/Libc/Libc-1439.40.11/regex/FreeBSD/re_format.7.auto.html [2] https://www.unix.com/man-page/osx/7/re_format/