Thread (13 messages) flat view 13 messages, 4 authors, 2016-06-15

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

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:47:57

Ilari Liusvaara schrieb:
On Thu, Dec 31, 2009 at 06:48:02PM +0100, Johannes Sixt wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help