git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Mario Grgic <mario_grgic@hotmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: git bug: Perl compatible regular expressions do not work as expected
Date: Mon, 27 Mar 2023 20:03:26 -0400	[thread overview]
Message-ID: <MW4PR20MB5517CBF944D108A95665025A90889@MW4PR20MB5517.namprd20.prod.outlook.com> (raw)
In-Reply-To: <xmqqtty5nbm4.fsf@gitster.g>

Interesting. I could be wrong. Let me clarify what I did and what I observe. I edited the Makefile and put back the NO_REGEX = YesPlease line. Then I configured the build as 

./configure —with-libpcre2=/usr/local 

then built and installed git. 

otool -L git shows git binary is dynamically linking the libpcre in /usr/local

However, it looks like this third party library is also used for -G  searches (plain POSIX regex or PCRE), since it accepts and correctly finds things like ‘\btext\b’. That is 

git log —all -p -G ‘\main\b’

works

Furthermore, -G works with multibyte strings as well: 

git log --all -p  -G '顔🏁’

What doesn’t work is multibyte strings with PCRESs, so for example this does not work:

git log --all -p  -G ‘\b顔🏁\b’

This doesn’t seem to be consistent with the thesis that regex library from compat is used for -G searches and that it doesn’t support multibyte strings?


> On Mar 27, 2023, at 5:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Mario Grgic <mario_grgic@hotmail.com> writes:
> 
> [administrivia: do not top post]
> 
>>> Mario Grgic <mario_grgic@hotmail.com> writes:
>>> ...
>>>> +	NO_REGEX = YesPlease
>>>> 	PTHREAD_LIBS =
>>>> endif
>>> 
>>> It will unfortunately break multibyte support on macOS by reverting
>>> what 1819ad32 (grep: fix multibyte regex handling under macOS,
>>> 2022-08-26) did.
> 
>> In my case, I compiled git with pcre2 support, using third party
>> PCRE2 library: https://github.com/PCRE2Project/pcre2 and PCRE and
>> multibyte support in git works with it just fine.
> 
> Sorry, you misunderstood.  1819ad32 is about enabling multi-byte
> support for normal regexp types, and does not have anything to do
> with pcre.  By setting NO_REGEX, the build will not link with
> Apple's regex library but the one from compat/ and that version is
> what is used for -G and -E (not -P).  -G/-E patterns with multi-byte
> would not work with compat/ stuff, but they should work when linked
> with Apple's regex library.
> 


      reply	other threads:[~2023-03-28  0:03 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
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 [this message]

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=MW4PR20MB5517CBF944D108A95665025A90889@MW4PR20MB5517.namprd20.prod.outlook.com \
    --to=mario_grgic@hotmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).