{"thread":{"id":"51509","subject":"[PATCH] grep: print the pcre2_jit_on value","startedAt":"2019-07-22T18:29:29Z","lastAt":"2019-07-29T08:43:56Z","messageCount":6,"participants":["Beat Bolli","Junio C Hamano","Johannes Schindelin","Carlo Arenas"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"379154","messageId":"20190722181923.21572-1-dev+git@drbeat.li","threadId":"51509","inReplyTo":null,"subject":"[PATCH] grep: print the pcre2_jit_on value","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2019-07-22T18:19:23Z","receivedAt":"2019-07-22T18:29:29Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"When pcre2_jit_on is neither 1 nor 0, the BUG() call printed the value\nof pcre1_jit_on.\n\nPrint the value of pcre2_jit_on instead.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n grep.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/grep.c b/grep.c\nindex f7c3a5803e..cd952ef5d3 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt\n \t\tpcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);\n \t} else if (p->pcre2_jit_on != 0) {\n \t\tBUG(\"The pcre2_jit_on variable should be 0 or 1, not %d\",\n-\t\t    p->pcre1_jit_on);\n+\t\t    p->pcre2_jit_on);\n \t}\n }\n \n-- \n2.21.0.1020.gf2820cf01a\n\n"},{"id":"379175","messageId":"xmqq1rygu01q.fsf@gitster-ct.c.googlers.com","threadId":"51509","inReplyTo":"20190722181923.21572-1-dev+git@drbeat.li","subject":"Re: [PATCH] grep: print the pcre2_jit_on value","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-07-23T17:34:57Z","receivedAt":"2019-07-23T17:35:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Beat Bolli <dev+git@drbeat.li> writes:\n\n> When pcre2_jit_on is neither 1 nor 0, the BUG() call printed the value\n> of pcre1_jit_on.\n>\n> Print the value of pcre2_jit_on instead.\n>\n> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n> ---\n\nThanks.\n\n\n>  grep.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/grep.c b/grep.c\n> index f7c3a5803e..cd952ef5d3 100644\n> --- a/grep.c\n> +++ b/grep.c\n> @@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt\n>  \t\tpcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);\n>  \t} else if (p->pcre2_jit_on != 0) {\n>  \t\tBUG(\"The pcre2_jit_on variable should be 0 or 1, not %d\",\n> -\t\t    p->pcre1_jit_on);\n> +\t\t    p->pcre2_jit_on);\n>  \t}\n>  }\n"},{"id":"379176","messageId":"nycvar.QRO.7.76.6.1907232118460.21907@tvgsbejvaqbjf.bet","threadId":"51509","inReplyTo":"20190722181923.21572-1-dev+git@drbeat.li","subject":"Re: [PATCH] grep: print the pcre2_jit_on value","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-07-23T19:19:16Z","receivedAt":"2019-07-23T19:19:28Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Beat,\n\nOn Mon, 22 Jul 2019, Beat Bolli wrote:\n\n> When pcre2_jit_on is neither 1 nor 0, the BUG() call printed the value\n> of pcre1_jit_on.\n>\n> Print the value of pcre2_jit_on instead.\n>\n> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n> ---\n>  grep.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/grep.c b/grep.c\n> index f7c3a5803e..cd952ef5d3 100644\n> --- a/grep.c\n> +++ b/grep.c\n> @@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt\n>  \t\tpcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);\n>  \t} else if (p->pcre2_jit_on != 0) {\n>  \t\tBUG(\"The pcre2_jit_on variable should be 0 or 1, not %d\",\n> -\t\t    p->pcre1_jit_on);\n> +\t\t    p->pcre2_jit_on);\n\nSeems obviously good.\n\nMaybe while you're in the vicinity, you can add that information to the\n`--debug` output?\n\nThanks,\nDscho\n\n>  \t}\n>  }\n>\n> --\n> 2.21.0.1020.gf2820cf01a\n>\n>\n"},{"id":"379223","messageId":"c85bcde8-2bef-3345-ec43-9ab44e587e39@drbeat.li","threadId":"51509","inReplyTo":"nycvar.QRO.7.76.6.1907232118460.21907@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] grep: print the pcre2_jit_on value","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2019-07-24T21:25:03Z","receivedAt":"2019-07-24T21:25:12Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"Hi Dscho,\n\nOn 23.07.19 21:19, Johannes Schindelin wrote:\n> Hi Beat,\n> \n> On Mon, 22 Jul 2019, Beat Bolli wrote:\n> \n>> When pcre2_jit_on is neither 1 nor 0, the BUG() call printed the value\n>> of pcre1_jit_on.\n>>\n>> Print the value of pcre2_jit_on instead.\n>>\n>> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n>> ---\n>>  grep.c | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/grep.c b/grep.c\n>> index f7c3a5803e..cd952ef5d3 100644\n>> --- a/grep.c\n>> +++ b/grep.c\n>> @@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt\n>>  \t\tpcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);\n>>  \t} else if (p->pcre2_jit_on != 0) {\n>>  \t\tBUG(\"The pcre2_jit_on variable should be 0 or 1, not %d\",\n>> -\t\t    p->pcre1_jit_on);\n>> +\t\t    p->pcre2_jit_on);\n> \n> Seems obviously good.\n> \n> Maybe while you're in the vicinity, you can add that information to the\n> `--debug` output?\n\nDo you mean something like this?\n\ndiff --git a/grep.c b/grep.c\nindex cd952ef5d3..8a57ba998f 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -406,6 +406,8 @@ static void compile_pcre1_regexp(struct grep_pat *p,\nconst struct grep_opt *opt)\n\n #ifdef GIT_PCRE1_USE_JIT\n        pcre_config(PCRE_CONFIG_JIT, &p->pcre1_jit_on);\n+       if (opt->debug)\n+               fprintf(stderr, \"pcre1_jit_on=%d\\n\", p->pcre1_jit_on);\n        if (p->pcre1_jit_on == 1) {\n                p->pcre1_jit_stack = pcre_jit_stack_alloc(1, 1024 * 1024);\n                if (!p->pcre1_jit_stack)\n@@ -522,6 +524,8 @@ static void compile_pcre2_pattern(struct grep_pat\n*p, const struct grep_opt *opt\n        }\n\n        pcre2_config(PCRE2_CONFIG_JIT, &p->pcre2_jit_on);\n+       if (opt->debug)\n+               fprintf(stderr, \"pcre2_jit_on=%d\\n\", p->pcre2_jit_on);\n        if (p->pcre2_jit_on == 1) {\n                jitret = pcre2_jit_compile(p->pcre2_pattern,\nPCRE2_JIT_COMPLETE);\n                if (jitret)\n\nIf so, I'll wait a bit until it's clear whether Ævar's series [1] or my\npatch is going to be applied.\n\nIf this is missing your intentions, I need more guidance ;-)\n\n[1] https://public-inbox.org/git/20190724151415.3698-1-avarab@gmail.com/\n\n\n> \n> Thanks,\n> Dscho\n> \n>>  \t}\n>>  }\n>>\n\nCheers,\nBeat\n"},{"id":"379242","messageId":"nycvar.QRO.7.76.6.1907251111140.21907@tvgsbejvaqbjf.bet","threadId":"51509","inReplyTo":"c85bcde8-2bef-3345-ec43-9ab44e587e39@drbeat.li","subject":"Re: [PATCH] grep: print the pcre2_jit_on value","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-07-25T09:13:08Z","receivedAt":"2019-07-25T09:13:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Beat,\n\nOn Wed, 24 Jul 2019, Beat Bolli wrote:\n\n> On 23.07.19 21:19, Johannes Schindelin wrote:\n> >\n> > On Mon, 22 Jul 2019, Beat Bolli wrote:\n> >\n> >> When pcre2_jit_on is neither 1 nor 0, the BUG() call printed the value\n> >> of pcre1_jit_on.\n> >>\n> >> Print the value of pcre2_jit_on instead.\n> >>\n> >> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n> >> ---\n> >>  grep.c | 2 +-\n> >>  1 file changed, 1 insertion(+), 1 deletion(-)\n> >>\n> >> diff --git a/grep.c b/grep.c\n> >> index f7c3a5803e..cd952ef5d3 100644\n> >> --- a/grep.c\n> >> +++ b/grep.c\n> >> @@ -559,7 +559,7 @@ static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt\n> >>  \t\tpcre2_jit_stack_assign(p->pcre2_match_context, NULL, p->pcre2_jit_stack);\n> >>  \t} else if (p->pcre2_jit_on != 0) {\n> >>  \t\tBUG(\"The pcre2_jit_on variable should be 0 or 1, not %d\",\n> >> -\t\t    p->pcre1_jit_on);\n> >> +\t\t    p->pcre2_jit_on);\n> >\n> > Seems obviously good.\n> >\n> > Maybe while you're in the vicinity, you can add that information to the\n> > `--debug` output?\n>\n> Do you mean something like this?\n\nYes!\n\n> diff --git a/grep.c b/grep.c\n> index cd952ef5d3..8a57ba998f 100644\n> --- a/grep.c\n> +++ b/grep.c\n> @@ -406,6 +406,8 @@ static void compile_pcre1_regexp(struct grep_pat *p,\n> const struct grep_opt *opt)\n>\n>  #ifdef GIT_PCRE1_USE_JIT\n>         pcre_config(PCRE_CONFIG_JIT, &p->pcre1_jit_on);\n> +       if (opt->debug)\n> +               fprintf(stderr, \"pcre1_jit_on=%d\\n\", p->pcre1_jit_on);\n>         if (p->pcre1_jit_on == 1) {\n>                 p->pcre1_jit_stack = pcre_jit_stack_alloc(1, 1024 * 1024);\n>                 if (!p->pcre1_jit_stack)\n> @@ -522,6 +524,8 @@ static void compile_pcre2_pattern(struct grep_pat\n> *p, const struct grep_opt *opt\n>         }\n>\n>         pcre2_config(PCRE2_CONFIG_JIT, &p->pcre2_jit_on);\n> +       if (opt->debug)\n> +               fprintf(stderr, \"pcre2_jit_on=%d\\n\", p->pcre2_jit_on);\n>         if (p->pcre2_jit_on == 1) {\n>                 jitret = pcre2_jit_compile(p->pcre2_pattern,\n> PCRE2_JIT_COMPLETE);\n>                 if (jitret)\n>\n> If so, I'll wait a bit until it's clear whether Ævar's series [1] or my\n> patch is going to be applied.\n\nSounds fair.\n\nHowever, my reading of those patches is that they still keep support for\nJIT'ed and non-JIT'ed PCRE2 invocations (preferring the former if\navailable, without any UI to change Git's behavior in that respect), so\nI would be surprised if this patch wasn't applicable after Ævar's\npatches.\n\nThanks,\nDscho\n\n>\n> If this is missing your intentions, I need more guidance ;-)\n>\n> [1] https://public-inbox.org/git/20190724151415.3698-1-avarab@gmail.com/\n>\n>\n> >\n> > Thanks,\n> > Dscho\n> >\n> >>  \t}\n> >>  }\n> >>\n>\n> Cheers,\n> Beat\n>\n"},{"id":"379477","messageId":"CAPUEspjS7wpp=XVJpxzyEoKq-27C72hiVRynwERwZsmpEcLJkQ@mail.gmail.com","threadId":"51509","inReplyTo":"nycvar.QRO.7.76.6.1907251111140.21907@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] grep: print the pcre2_jit_on value","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2019-07-29T08:43:43Z","receivedAt":"2019-07-29T08:43:56Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Thu, Jul 25, 2019 at 5:50 AM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> On Wed, 24 Jul 2019, Beat Bolli wrote:\n> > Do you mean something like this?\n>\n> Yes!\n\nIdeally, though, you want to print those values closing to the match\nfunction (pcre_exec for PCRE1\nor pcre2_[jit_]match for PCRE2 as they might change after they are\nextracted from the PCRE configuration\nwith pcre[2]-config()\n\n> > If so, I'll wait a bit until it's clear whether Ævar's series [1] or my\n> > patch is going to be applied.\n>\n> Sounds fair\n\nFWIW they are both applied (yours all the way to next), but Ævar's\nchanges now in pu (but likely to be rerolled soon) will most likely\nremove your code (as explained on Junio's emails)\n\n> However, my reading of those patches is that they still keep support for\n> JIT'ed and non-JIT'ed PCRE2 invocations (preferring the former if\n> available, without any UI to change Git's behavior in that respect), so\n> I would be surprised if this patch wasn't applicable after Ævar's\n> patches.\n\nthe PCRE1 changes are significant enough that would break the current\ncheck and might\nneed a more convoluted check to figure out if JIT was actually used by\npcre_exec.\n\nmore details in the configuration[1]\n\nCarlo\n\n[1] https://www.pcre.org/original/doc/html/pcrejit.html\n"}]}