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

SIGPIPE handling (Re: [PATCH v3 0/3])

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 18, 2012, 10:06 UTC
Message-ID
<20120218100517.GA8998@burratino>
In-Reply-To
<20120218085221.GA13922@sigill.intra.peff.net>
Hi,
Jeff King wrote:
> Less robust than that is to just ignore SIGPIPE in most git programs
> (which don't benefit from it, and where it is only a liability), but
> then manually enable it for the few that care

This seems backwards. Aren't the only places where it is just a liability places where git is writing to a pipe that git has created?

We could keep the benefits of SIGPIPE (including simpler error handling and lack of distracting EPIPE message) in most code, and only switch to SIGPIPE-ignored semantics where the signal has a chance to cause harm. Maybe run_command should automatically ignore SIGPIPE when creating a pipe for the launched command's standard input (with a flag to ask not to), as a rough heuristic.

There's a subtlety I'm glossing over here, which is that for commands that produce a lot of output (think: "git fetch --all"), output may still not the primary goal. I think even they should not block SIGPIPE, to follow the principle of least surprise in the following interaction:

	git fetch --all 2>&1 | less
	... one page later, get bored ...
	q (to quit)

Most Unix programs would be killed by SIGPIPE after such a sequence, so I would expect git to be, too.

Just my two cents, Jonathan

Previous: Jeff KingNext: Jonathan Nieder
Message 14 of 19 in “Adding a performance framework”
  1. 0/3 Adding a performance frameworkThomas Rast, Feb 16, 2012
  2. 1/3 Move the user-facing test library to test-lib-functions.shThomas Rast, Feb 16, 2012
  3. Junio C HamanoFeb 16, 2012
  4. Thomas RastFeb 17, 2012
  5. 0/3 Thomas Rast, Feb 17, 2012
  6. 1/3 Move the user-facing test library to test-lib-functions.shThomas Rast, Feb 17, 2012
  7. 2/3 Introduce a performance testing frameworkThomas Rast, Feb 17, 2012
  8. 3/3 Add a performance test for git-grepThomas Rast, Feb 17, 2012
  9. Junio C HamanoFeb 17, 2012
  10. Junio C HamanoFeb 17, 2012
  11. Jeff KingFeb 18, 2012
  12. Junio C HamanoFeb 18, 2012
  13. Jeff KingFeb 18, 2012
  14. SIGPIPE handling (Re: [PATCH v3 0/3])Jonathan Nieder, Feb 18, 2012
  15. Jonathan NiederFeb 18, 2012
  16. Jeff KingFeb 18, 2012
  17. 2/3 Introduce a performance testing frameworkThomas Rast, Feb 16, 2012
  18. Jeff KingFeb 17, 2012
  19. 3/3 Add a performance test for git-grepThomas Rast, Feb 16, 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.