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

Re: [updated patch v3 1/2] Report exec errors from run-command

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 5, 2010, 05:11 UTC
Message-ID
<7vaawt87aw.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B3CF568.1050705@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 15 quoted lines
> Ilari Liusvaara schrieb:
>> +static inline void force_close(int fd)
>> +{
>> +	/*
>> +	 * The close is deemed success or failed in non-transient way if
>> +	 * close() suceeds, returns EBADF or error other than EINTR or
>> +	 * EAGAIN.
>> +	 */
>> +	while (close(fd) < 0 && errno != EBADF)
>> +		if(errno != EINTR && errno != EAGAIN)
>> +			break;
>
> You are constantly ignoring proposals to iterate only on EINTR and
> EAGAIN, but do not make an argument why you do otherwise. Did I miss
> something?
Meaning something like this?
	static inline void force_close(int fd)
	{
		/*
		 * Retry failed close() on EINTR or EAGAIN
		 */
		while (close(fd) < 0 && (errno == EINTR || errno == EAGAIN))
			; /* try again */
	}

which should be equivalent as long as EBADF is different from EINTR and EAGAIN, I think.

Show 12 quoted lines
>> +	if (cmd->pid > 0) {
>> +		int r = 0, ret;
>> +		force_close(report_pipe[1]);
>> +read_again:
>> ...
>> +			if(waitpid(cmd->pid, &ret, 0) < 0 && errno == EINTR)
>> +				/* Nothing. */ ;
>> +			cmd->pid = -1;
>
> As per Documentation/technical/api-run-command.txt, you should write
> an error here, except if (failed_errno==ENOENT &&
> cmd->silent_exec_failure!=0).

I was planning to replace the earlier series that was dropped from pu with this iteration, but I guess I'll wait for another round before doing so.

Thanks for reviewing.
>> +test_expect_success "reporting ENOENT" \
>> +"test-run-command 1"
>
> I wonder what this parameter "1" is good for...

I guessed that this is for adding more tests to test-run-command in the future and not having to change this test, in which case I think it is a sensible thing to do.

Previous: Johannes SixtNext: Ilari Liusvaara
Message 4 of 6 in “Imporve remote helpers exec failure reporting”
  1. 0/2 Imporve remote helpers exec failure reportingIlari Liusvaara, Dec 31, 2009
  2. 1/2 Report exec errors from run-commandIlari Liusvaara, Dec 31, 2009
  3. Johannes SixtDec 31, 2009
  4. Junio C HamanoJan 5, 2010
  5. 2/2 Improve transport helper exec failure reportingIlari Liusvaara, Dec 31, 2009
  6. Johannes SixtDec 31, 2009

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.