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

Re: git bug: Perl compatible regular expressions do not work as expected

From
MGMario Grgic <mario_grgic@hotmail.com>
Date
Mar 25, 2023, 14:16 UTC
Message-ID
<MW4PR20MB551709099740DB3777C5CEAD90859@MW4PR20MB5517.namprd20.prod.outlook.com>
In-Reply-To
<MW4PR20MB5517583CBEEF34B1E87CCF1290859@MW4PR20MB5517.namprd20.prod.outlook.com>
According to git bisect, this got broken in the following commit:
commit 1819ad327b7a1f19540a819813b70a0e8a7f798f
Author: Diomidis Spinellis <dds@aueb.gr>
Date:   Fri Aug 26 11:58:15 2022 +0300
    grep: fix multibyte regex handling under macOS
    
    The commit 29de20504e (Makefile: fix default regex settings on
    Darwin, 2013-05-11) fixed t0070-fundamental.sh under Darwin (macOS) by
    adopting Git's regex library.  However, this library is compiled with
    NO_MBSUPPORT, which causes git-grep to work incorrectly on multibyte
    (e.g. UTF-8) files.  Current macOS versions pass t0070-fundamental.sh
    with the native macOS regex library, which also supports multibyte
    characters.
    
    Adjust the Makefile to use the native regex library, and call
    setlocale(3) to set CTYPE according to the user's preference.
    The setlocale call is required on all platforms, but in platforms
    supporting gettext(3), setlocale was called as a side-effect of
    initializing gettext.  Therefore, move the CTYPE setlocale call from
    gettext.c to common-main.c and the corresponding locale.h include
    into git-compat-util.h.
    
    Thanks to the global initialization of CTYPE setlocale, the test-tool
    regex command now works correctly with supported multibyte regexes, and
    is used to set the MB_REGEX test prerequisite by assessing a platform's
    support for them.
    
    Signed-off-by: Diomidis Spinellis <dds@aueb.gr>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
 Makefile          |  2 +-
 common-main.c     |  1 +
 gettext.c         |  2 --
 git-compat-util.h |  1 +
 t/t7810-grep.sh   | 15 +++++++++++++++
 5 files changed, 18 insertions(+), 3 deletions(-)
Previous: René ScharfeNext: Mario Grgic
Message 13 of 18 in “git bug: Perl compatible regular expressions do not work as expected”
  1. Mario GrgicMar 25, 2023
  2. Kristoffer HaugsbakkMar 25, 2023
  3. Mario GrgicMar 25, 2023
  4. demerphqMar 25, 2023
  5. Mario GrgicMar 25, 2023
  6. demerphqMar 25, 2023
  7. René ScharfeMar 25, 2023
  8. Junio C HamanoMar 27, 2023
  9. René ScharfeMar 27, 2023
  10. Junio C HamanoMar 27, 2023
  11. Junio C HamanoMar 28, 2023
  12. René ScharfeMar 28, 2023
  13. Mario GrgicMar 25, 2023
  14. Mario GrgicMar 25, 2023
  15. Junio C HamanoMar 27, 2023
  16. Mario GrgicMar 27, 2023
  17. Junio C HamanoMar 27, 2023
  18. Mario GrgicMar 28, 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.