Thread (3 messages) 3 messages, 3 authors, 2023-01-31

Re: [PATCH v2] grep: fall back to interpreter if JIT memory allocation fails

From: Ramsay Jones <hidden>
Date: 2023-01-30 22:30:33

Possibly related (same subject, not in this thread)


On 30/01/2023 21:21, Junio C Hamano wrote:
quoted hunk ↗ jump to hunk
Junio C Hamano [off-list ref] writes:
quoted
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
+			    : "");
 		}
 
 		/*
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help