Re: [PATCH v2] grep: fall back to interpreter if JIT memory allocation fails
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- Jan 30, 2023, 22:30 UTC
- Message-ID
- <55c75313-79d4-1c5b-951b-5d1e75553441@ramsayjones.plus.com>
- In-Reply-To
- <xmqqk0131zxi.fsf@gitster.g>
On 30/01/2023 21:21, Junio C Hamano wrote:
Show 29 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Having said all that, I do not mind queuing v2 if the "use *NO_JIT
>> to disable" is added to the message to help users who are forced to
>> redo the query.
>
> In the meantime, here is what I plan to apply on top of v2 while
> queuing it. The message given to die() should lack the terminating
> LF, and the overlong line can and should be split at operator
> boundary.
>
> Thanks.
>
> grep.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git c/grep.c w/grep.c
> index 59afc3f07f..42f184bd09 100644
> --- c/grep.c
> +++ w/grep.c
> @@ -357,7 +357,11 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt
> p->pcre2_jit_on = 0;
> return;
> } else if (jitret) {
> - die("Couldn't JIT the PCRE2 pattern '%s', got '%d'\n", p->pattern, jitret);
> + die("Couldn't JIT the PCRE2 pattern '%s', got '%d'%s",
> + p->pattern, jitret,
> + pcre2_jit_functional()
> + ? "\nPerhaps prefix (*NO_GIT) to your pattern?" s/NO_GIT/NO_JIT/ ? :)
ATB, Ramsay Jones
> + : ""); > } > > /*