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

Re: [PATCH] t5570: forward git-daemon messages in a different way

From
Jeff King <peff@peff.net>
Date
Apr 26, 2012, 13:01 UTC
Message-ID
<20120426130129.GA27785@sigill.intra.peff.net>
In-Reply-To
<4F8FB779.60004@viscovery.net>
On Thu, Apr 19, 2012 at 08:58:01AM +0200, Johannes Sixt wrote:
Show 15 quoted lines
> > 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
Previous: Johannes SixtNext: Johannes Sixt
Message 13 of 20 in “t5570: forward git-daemon messages in a different way”
  1. t5570: forward git-daemon messages in a different wayZbigniew Jędrzejewski-Szmek, Apr 14, 2012
  2. Clemens BuchacherApr 14, 2012
  3. Clemens BuchacherApr 14, 2012
  4. Zbigniew Jędrzejewski-SzmekApr 16, 2012
  5. Junio C HamanoApr 16, 2012
  6. Clemens BuchacherApr 16, 2012
  7. Zbigniew Jędrzejewski-SzmekApr 16, 2012
  8. Junio C HamanoApr 17, 2012
  9. Jeff KingApr 16, 2012
  10. Clemens BuchacherApr 16, 2012
  11. Jeff KingApr 19, 2012
  12. Johannes SixtApr 19, 2012
  13. Jeff KingApr 26, 2012
  14. Johannes SixtApr 26, 2012
  15. Clemens BuchacherApr 26, 2012
  16. t5570: fix forwarding of git-daemon messages via catJohannes Sixt, Apr 26, 2012
  17. Zbigniew Jędrzejewski-SzmekApr 26, 2012
  18. Jeff KingApr 27, 2012
  19. Junio C HamanoApr 27, 2012
  20. Jeff KingApr 27, 2012

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.