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

Re: [Updated PATCH 2/2] Improve transport helper exec failure reporting

From
Johannes Sixt <j6t@kdbg.org>
Date
Dec 31, 2009, 18:44 UTC
Message-ID
<4B3CF118.7080404@kdbg.org>
In-Reply-To
<20091231182436.GA1326@Knoppix>
Ilari Liusvaara schrieb:
Show 21 quoted lines
> On Thu, Dec 31, 2009 at 06:48:02PM +0100, Johannes Sixt wrote:
>> In case 3, it is expected that the child process prints a suitable
>> error message. Therefore, you should start with merely replacing the
>> unconditional
>>
>> 	exit(127);
>> by
>> 	if (errno == ENOENT)
>> 		exit(127);
>> 	else
>> 		die_errno("Cannot exec %s", cmd->argv[0]);
>>
>> And then you can think about how you support the ENOENT case better.
>> My proposal for this was to do the PATH lookup manually before the
>> fork(), and then the above conditional would melt down to simply:
>>
>> 	die_errno("Cannot exec %s", cmd->argv[0]);
>>
> 
> The child process can't sanely print anything. Stderr would go to
> who knows where.
Wrong - because:
> Parent process should have much better idea what to
> do with errors.

Very correct. For this reason, the parent process assigns a stderr channel to the child (or does not do so to inherit its own stderr), and the child is expected to use it. Errors due to execvp failures are no exception, IMO (except ENOENT, as always).

-- Hannes
Previous: Ilari LiusvaaraNext: Johannes Sixt
Message 12 of 13 in “Improve remote helpers exec error reporting”
  1. 0/2 Improve remote helpers exec error reportingIlari Liusvaara, Dec 30, 2009
  2. 1/2 Report exec errors from run-commandIlari Liusvaara, Dec 30, 2009
  3. Erik Faye-LundDec 30, 2009
  4. TarmiganDec 31, 2009
  5. Ilari LiusvaaraDec 31, 2009
  6. TarmiganDec 31, 2009
  7. 2/2 Improve transport helper exec failure reportingIlari Liusvaara, Dec 30, 2009
  8. Johannes SixtDec 31, 2009
  9. Ilari LiusvaaraDec 31, 2009
  10. Johannes SixtDec 31, 2009
  11. Ilari LiusvaaraDec 31, 2009
  12. Johannes SixtDec 31, 2009
  13. Johannes SixtJan 1, 2010

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.