From: Joshua Hudson Date: Tue, 27 Jun 2023 13:43:38 GMT Subject: Re: [PATCH] ll-merge: killing the external merge driver aborts the merge Message-ID: <45ca0983-a0b6-1372-b548-2e0351988587@cedaron.com> In-Reply-To: <59b7a582-be68-3f7b-a06f-3bd662582a1d@gmx.de> On 6/27/2023 5:02 AM, Johannes Schindelin wrote: > Hi, > > > On Fri, 23 Jun 2023, Junio C Hamano wrote: > >> Junio C Hamano writes: >> >>> Elijah Newren writes: >>> >>>> Reviewed-by: Elijah Newren >>> >>> Thanks for a quick review. >> Unfortunately Windows does not seem to correctly detect the aborting >> merge driver. Does run_command() there report process death due to >> signals differently, I wonder? >> >> https://github.com/git/git/actions/runs/5360400800/jobs/9725341775#step:6:285 >> >> shows that on Windows, aborted external merge driver is not noticed >> and we happily take the auto-merged result, ouch. > Hmm. I tried to verify this, but failed. With this patch: > > ```diff > diff --git a/git.c b/git.c > index 2f42da20f4e0..3c513e3f2cb1 100644 > --- a/git.c > +++ b/git.c > @@ -330,6 +330,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) > setenv(GIT_ATTR_SOURCE_ENVIRONMENT, cmd, 1); > if (envchanged) > *envchanged = 1; > + } else if (!strcmp(cmd, "--abort")) { > + abort(); > } else { > fprintf(stderr, _("unknown option: %s\n"), cmd); > usage(git_usage_string); > ``` > > I get this: > > > ```console > $ ./git.exe --abort > > $ echo $? > 3 > ``` > > For that reason, I am somehow doubtful that the `abort()` is actually > called?!? > > Ciao, > Johannes abort(); does _exit(3); on Windows because there are no signals. This is easily changed by providing abort like so: void abort() { _exit(131 /* or whatever else you think goes here */); }