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

Re: macOS git grep change in required character classes

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 1, 2023, 17:56 UTC
Message-ID
<xmqq355jbi6d.fsf@gitster.g>
In-Reply-To
<CA+MNPvg9JX8S2fOcH9NEq=d04BcCgbf5Qwc070WWwjXpUsd3Sw@mail.gmail.com>
Matt Gardner <four712@gmail.com> writes:
Show 8 quoted lines
> Even though the grep that ships with macOS is GNU compatible?
>
> $ which grep
> /usr/bin/grep
> $ grep -V
> grep (BSD grep) 2.5.1-FreeBSD
> $ grep -E \\btest\\b test.pl
> sub test { return; }

It seems that use of REG_ENHANCED bit (which gives some GNUism enhancement to regex engine of BSD origin) is inconsistent even among tools shipped by Apple,

cf. https://lore.kernel.org/git/4e03ea47-b0aa-d69e-6c54-fcbadb3b0641@web.de/
which may even contribute to the confusion.

I think we recently (of course this is after we stopped doing NO_REGEX and switched to macOS native regex library) started using the ENHANCED bit only for BRE and we do not use ENHANCED bit for ERE, and the cited thread (which has "pcre" on the subject, but it turns out that the symptom had nothing to do with pcre) discussed possible use of the same enhanced bit for ERE by us.

Previous: Matt Gardner
Message 4 of 4 in “macOS git grep change in required character classes”
  1. Matt GardnerApr 1, 2023
  2. Junio C HamanoApr 1, 2023
  3. Matt GardnerApr 1, 2023
  4. Junio C HamanoApr 1, 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.