Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:58

Johannes Sixt [off-list ref] writes:
Ilari Liusvaara schrieb:
quoted
+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.
quoted
+	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.
quoted
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help