From: Mario Grgic <mario_grgic@hotmail.com>
To: git@vger.kernel.org
Subject: Re: git bug: Perl compatible regular expressions do not work as expected
Date: Sat, 25 Mar 2023 10:16:09 -0400 [thread overview]
Message-ID: <MW4PR20MB551709099740DB3777C5CEAD90859@MW4PR20MB5517.namprd20.prod.outlook.com> (raw)
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(-)
next prev parent reply other threads:[~2023-03-25 14:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 12:31 git bug: Perl compatible regular expressions do not work as expected Mario Grgic
2023-03-25 12:42 ` Kristoffer Haugsbakk
2023-03-25 12:59 ` Mario Grgic
2023-03-25 13:04 ` demerphq
2023-03-25 13:09 ` Mario Grgic
2023-03-25 13:24 ` demerphq
2023-03-25 18:09 ` René Scharfe
2023-03-27 16:29 ` Junio C Hamano
2023-03-27 17:23 ` René Scharfe
2023-03-27 21:33 ` Junio C Hamano
2023-03-28 13:47 ` Junio C Hamano
2023-03-28 17:56 ` René Scharfe
2023-03-25 14:16 ` Mario Grgic [this message]
2023-03-25 15:39 ` Mario Grgic
2023-03-27 16:30 ` Junio C Hamano
2023-03-27 17:22 ` Mario Grgic
2023-03-27 21:11 ` Junio C Hamano
2023-03-28 0:03 ` Mario Grgic
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW4PR20MB551709099740DB3777C5CEAD90859@MW4PR20MB5517.namprd20.prod.outlook.com \
--to=mario_grgic@hotmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).