From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Simon Ruderich <simon@ruderich.org>
Cc: Jeff King <peff@peff.net>,
git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Brandon Casey <drafnel@gmail.com>
Subject: Re: [PATCH] die routine: change recursion limit from 1 to 1024
Date: Wed, 21 Jun 2017 12:10:50 +0200 [thread overview]
Message-ID: <87h8z98xcl.fsf@gmail.com> (raw)
In-Reply-To: <20170621081209.gfqqkselek4bqdjl@ruderich.org>
On Wed, Jun 21 2017, Simon Ruderich jotted:
> On Tue, Jun 20, 2017 at 08:49:59PM +0200, Ævar Arnfjörð Bjarmason wrote:
>> If I understand you correctly this on top:
>>
>> diff --git a/usage.c b/usage.c
>> index 1c198d4882..f6d5af2bb4 100644
>> --- a/usage.c
>> +++ b/usage.c
>> @@ -46,7 +46,19 @@ static int die_is_recursing_builtin(void)
>> static int dying;
>> static int recursion_limit = 1024;
>>
>> - return dying++ > recursion_limit;
>> + dying++;
>> +
>> + if (!dying) {
>
> This will never trigger as dying was incremented two lines
> before. But I think it's already handled by the dying <
> recursion_limit case so we can just omit it.
>
>> + /* ok, normal */
>> + return 0;
>> + } else if (dying < recursion_limit) {
>> + /* only show the warning once */
>> + if (dying == 1)
>> + warning("die() called many times. Recursion error or racy threaded death!");
>> + return 0; /* don't bail yet */
>> + } else {
>> + return 1;
>> + }
>> }
>
> Maybe restructure it like this:
>
> dying++
> if (dying > recursion_limit)
> return 1;
> if (dying == 1)
> warning();
> return 0;
Thanks, silly mistake. Will fix.
> Btw. is there a reason why recursion_limit is a static variable
> and not a constant/define?
Nope, will make it a const. Thanks.
prev parent reply other threads:[~2017-06-21 10:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-19 22:00 [PATCH] die routine: change recursion limit from 1 to 1024 Ævar Arnfjörð Bjarmason
2017-06-19 22:08 ` Stefan Beller
2017-06-19 22:32 ` Ævar Arnfjörð Bjarmason
2017-06-19 22:38 ` Stefan Beller
2017-06-21 20:47 ` [PATCH v2] die(): stop hiding errors due to overzealous recursion guard Ævar Arnfjörð Bjarmason
2017-06-21 21:12 ` Stefan Beller
2017-06-21 21:21 ` Morten Welinder
2017-06-21 21:40 ` Ævar Arnfjörð Bjarmason
2017-06-21 21:32 ` Junio C Hamano
2017-06-24 12:36 ` Jeff King
2017-06-24 18:32 ` Junio C Hamano
2017-06-20 15:54 ` [PATCH] die routine: change recursion limit from 1 to 1024 Jeff King
2017-06-20 16:15 ` Jeff King
2017-06-20 18:49 ` Ævar Arnfjörð Bjarmason
2017-06-20 19:05 ` Jeff King
2017-06-21 8:12 ` Simon Ruderich
2017-06-21 10:10 ` Ævar Arnfjörð Bjarmason [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h8z98xcl.fsf@gmail.com \
--to=avarab@gmail.com \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=simon@ruderich.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.
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 NNTP newsgroup(s).