Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-29 Thread Jeff King
On Mon, Oct 29, 2018 at 12:44:58PM +0900, Junio C Hamano wrote: > Jeff King writes: > > > Hmph. So I was speaking before purely hypothetically, but now that your > > patch is in 'next', it is part of my daily build. And indeed, I hit a > > false positive within 5 minutes of building it. ;) > >

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-28 Thread Junio C Hamano
Jeff King writes: > Hmph. So I was speaking before purely hypothetically, but now that your > patch is in 'next', it is part of my daily build. And indeed, I hit a > false positive within 5 minutes of building it. ;) Sounds like somebody is having not-so-fun-a-time having "I told you so"

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-26 Thread Ævar Arnfjörð Bjarmason
On Fri, Oct 26 2018, Jeff King wrote: > On Sat, Oct 20, 2018 at 02:58:53PM -0400, Jeff King wrote: > >> On Sat, Oct 20, 2018 at 01:14:28PM +0200, Ævar Arnfjörð Bjarmason wrote: >> >> > > I'd guess this sort of thing is pretty rare. But I wonder if we're >> > > crossing the line of trying to

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-26 Thread Jeff King
On Sat, Oct 20, 2018 at 02:58:53PM -0400, Jeff King wrote: > On Sat, Oct 20, 2018 at 01:14:28PM +0200, Ævar Arnfjörð Bjarmason wrote: > > > > I'd guess this sort of thing is pretty rare. But I wonder if we're > > > crossing the line of trying to assume too much about what the user's > > >

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-22 Thread Ævar Arnfjörð Bjarmason
On Mon, Oct 22 2018, Jeff King wrote: > On Sat, Oct 20, 2018 at 09:18:21PM +0200, Ævar Arnfjörð Bjarmason wrote: > >> We didn't support chained aliases at all before, so I think the odds >> that people will run into this now will increase as they add "!" to >> existing aliases, and I'd like to

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-22 Thread Jeff King
On Sat, Oct 20, 2018 at 09:18:21PM +0200, Ævar Arnfjörð Bjarmason wrote: > We didn't support chained aliases at all before, so I think the odds > that people will run into this now will increase as they add "!" to > existing aliases, and I'd like to have git's UI friendly enough to tell > users

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-21 Thread Junio C Hamano
Jeff King writes: > I agree it's probably quite rare, if it exists at all. But I also wonder > how important looping alias protection is. It's also rare, and the > outcome is usually "gee, I wonder why this is taking so long? ^C". > > At least that's my instinct. I don't remember having run into

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-20 Thread Ævar Arnfjörð Bjarmason
On Sat, Oct 20 2018, Jeff King wrote: > On Sat, Oct 20, 2018 at 01:14:28PM +0200, Ævar Arnfjörð Bjarmason wrote: > >> > I'd guess this sort of thing is pretty rare. But I wonder if we're >> > crossing the line of trying to assume too much about what the user's >> > arbitrary code does. >> > >>

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-20 Thread Jeff King
On Sat, Oct 20, 2018 at 01:14:28PM +0200, Ævar Arnfjörð Bjarmason wrote: > > I'd guess this sort of thing is pretty rare. But I wonder if we're > > crossing the line of trying to assume too much about what the user's > > arbitrary code does. > > > > A simple depth counter can limit the fork bomb,

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-20 Thread Ævar Arnfjörð Bjarmason
On Fri, Oct 19 2018, Jeff King wrote: > On Thu, Oct 18, 2018 at 10:57:39PM +, Ævar Arnfjörð Bjarmason wrote: > >> Add detection for aliasing loops in cases where one of the aliases >> re-invokes git as a shell command. This catches cases like: >> >> [alias] >> foo = !git bar >>

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-20 Thread Ævar Arnfjörð Bjarmason
On Fri, Oct 19 2018, Jeff King wrote: > On Fri, Oct 19, 2018 at 10:28:22AM +0200, Ævar Arnfjörð Bjarmason wrote: > >> > - string_list_append(_list, *argv[0]); >> > + add_cmd_history(, _list, *argv[0]); >> > >> >/* >> > * It could be an alias -- this

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-19 Thread Jeff King
On Fri, Oct 19, 2018 at 10:28:22AM +0200, Ævar Arnfjörð Bjarmason wrote: > > - string_list_append(_list, *argv[0]); > > + add_cmd_history(, _list, *argv[0]); > > > > /* > > * It could be an alias -- this works around the insanity > > Just to sanity

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-19 Thread Jeff King
On Thu, Oct 18, 2018 at 10:57:39PM +, Ævar Arnfjörð Bjarmason wrote: > Add detection for aliasing loops in cases where one of the aliases > re-invokes git as a shell command. This catches cases like: > > [alias] > foo = !git bar > bar = !git foo > > Before this change running

Re: [PATCH] alias: detect loops in mixed execution mode

2018-10-19 Thread Ævar Arnfjörð Bjarmason
On Thu, Oct 18 2018, Ævar Arnfjörð Bjarmason wrote: > +static void init_cmd_history(struct strbuf *env, struct string_list > *cmd_list) > +{ > + const char *old = getenv(COMMAND_HISTORY_ENVIRONMENT); > + struct strbuf **cmd_history, **ptr; > + > + if (!old || !*old) > +

[PATCH] alias: detect loops in mixed execution mode

2018-10-18 Thread Ævar Arnfjörð Bjarmason
Add detection for aliasing loops in cases where one of the aliases re-invokes git as a shell command. This catches cases like: [alias] foo = !git bar bar = !git foo Before this change running "git {foo,bar}" would create a forkbomb. Now using the aliasing loop detection and call