Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-16 Thread Johannes Sixt
Am 4/16/2013 15:01, schrieb Jeff King: > On Tue, Apr 16, 2013 at 09:18:46AM +0200, Johannes Sixt wrote: > >>> Yeah, that seems sane; my biggest worry was that it would create >>> headaches for Windows folks, who would have to emulate pthread_key. But >>> it seems like we already added support in 9

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-16 Thread Jeff King
On Tue, Apr 16, 2013 at 09:18:46AM +0200, Johannes Sixt wrote: > > Yeah, that seems sane; my biggest worry was that it would create > > headaches for Windows folks, who would have to emulate pthread_key. But > > it seems like we already added support in 9ba604a. > > pthread_key is not a problem,

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-16 Thread Johannes Sixt
Am 4/16/2013 4:50, schrieb Jeff King: > On Mon, Apr 15, 2013 at 07:34:07PM -0700, Brandon Casey wrote: > >>> Right. My assumption was that we are primarily interested in protecting >>> against the die_routine. Compat functions should never be calling die. >> >> I think the rule we have been enforc

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-15 Thread Jeff King
On Mon, Apr 15, 2013 at 07:34:07PM -0700, Brandon Casey wrote: > > Right. My assumption was that we are primarily interested in protecting > > against the die_routine. Compat functions should never be calling die. > > I think the rule we have been enforcing is less strict than that. We > have on

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-15 Thread Brandon Casey
On Mon, Apr 15, 2013 at 5:42 PM, Jeff King wrote: > On Mon, Apr 15, 2013 at 05:11:36PM -0700, Brandon Casey wrote: > >> > +static void check_die_recursion(const char *fmt, va_list ap) >> > +{ >> > + static int dying; >> > + >> > + if (!dying++) >> > + return; >> > + >> >

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-15 Thread Jonathan Nieder
Jeff King wrote: > I was also tempted to suggest just dropping the recursion check > altogether. While it is neat to detect such things, it's a "should never > happen" bug situation, and an infinite loop of printing out the same > message is pretty easy to notice. On servers it might be useful to

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-15 Thread Jeff King
On Mon, Apr 15, 2013 at 05:11:36PM -0700, Brandon Casey wrote: > > +static void check_die_recursion(const char *fmt, va_list ap) > > +{ > > + static int dying; > > + > > + if (!dying++) > > + return; > > + > > + vreportf("fatal: ", fmt, ap); > > How do you know it'

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-15 Thread Brandon Casey
On Mon, Apr 15, 2013 at 4:08 PM, Jeff King wrote: > When any git code calls die(), we chain to a custom > die_routine, which we expect to print a message and exit the > program. To avoid infinite loops, we detect a recursive call > to die() with a simple counter, and break out of the loop by > pri

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-15 Thread Jeff King
On Mon, Apr 15, 2013 at 07:45:03PM -0400, Eric Sunshine wrote: > On Mon, Apr 15, 2013 at 7:08 PM, Jeff King wrote: > > This patch teaches die() to print the original die message > > to stderr before reporting the recursion. The custom > > die_routine may or may not have put it the message to > >

Re: [PATCH 1/3] usage: refactor die-recursion checks

2013-04-15 Thread Eric Sunshine
On Mon, Apr 15, 2013 at 7:08 PM, Jeff King wrote: > This patch teaches die() to print the original die message > to stderr before reporting the recursion. The custom > die_routine may or may not have put it the message to s/put it the/emitted/ perhaps? > stderr, but this is the best we can do (i

[PATCH 1/3] usage: refactor die-recursion checks

2013-04-15 Thread Jeff King
When any git code calls die(), we chain to a custom die_routine, which we expect to print a message and exit the program. To avoid infinite loops, we detect a recursive call to die() with a simple counter, and break out of the loop by printing a message and exiting ourselves, without chaining to th