On Thu, Apr 19, 2012 at 08:58:01AM +0200, Johannes Sixt wrote: > > Hmm. Yeah, if you strace the cat, it gets an immediate EOF. And even > > weirder, I notice this in the strace output: > > > > clone(...) > > close(0) = 0 > > open("/dev/null", O_RDONLY) = 0 > > ... > > execve("/bin/cat", ["cat"], [/* 50 vars */]) = 0 > > > > What? The shell is literally redirecting the cat process's stdin from > > /dev/null. I'm totally confused. > > You don't have to be; it's mandated by POSIX: > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_03_02 Sorry for the delayed response. Thanks for the pointer; I looked in POSIX but couldn't find that passage. It does say "In all cases, explicit redirection of standard input shall override this activity". It looks like dash interprets that as "open /dev/null, then open the redirected stdin". Which leaves a race condition. So I think a custom wrapper like the one posted by Clemens is our only portable option. As an aside, should git-daemon be respecting SIGPIPE at all? It seems pointless at best, as it should be checking all of its writes, and a liability at worst, as something like failing to log to stderr can kill the whole process. (Ignoring SIGPIPE would downgrade the severity of this problem, but I think we would still want Clemens' solution. Otherwise the error output in the test could be truncated). -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html