git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] die routine: change recursion limit from 1 to 1024

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 21, 2017, 10:10 UTC
Message-ID
<87h8z98xcl.fsf@gmail.com>
In-Reply-To
<20170621081209.gfqqkselek4bqdjl@ruderich.org>
On Wed, Jun 21 2017, Simon Ruderich jotted:
Show 40 quoted lines
> 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.
Previous: Simon Ruderich
Message 17 of 17 in “die routine: change recursion limit from 1 to 1024”
  1. die routine: change recursion limit from 1 to 1024Ævar Arnfjörð Bjarmason, Jun 19, 2017
  2. Stefan BellerJun 19, 2017
  3. Ævar Arnfjörð BjarmasonJun 19, 2017
  4. Stefan BellerJun 19, 2017
  5. die(): stop hiding errors due to overzealous recursion guardÆvar Arnfjörð Bjarmason, Jun 21, 2017
  6. Stefan BellerJun 21, 2017
  7. Morten WelinderJun 21, 2017
  8. Ævar Arnfjörð BjarmasonJun 21, 2017
  9. Junio C HamanoJun 21, 2017
  10. Jeff KingJun 24, 2017
  11. Junio C HamanoJun 24, 2017
  12. Jeff KingJun 20, 2017
  13. Jeff KingJun 20, 2017
  14. Ævar Arnfjörð BjarmasonJun 20, 2017
  15. Jeff KingJun 20, 2017
  16. Simon RuderichJun 21, 2017
  17. Ævar Arnfjörð BjarmasonJun 21, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.