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

Re: [PATCH] Don't ignore write failure from git-diff, git-log, etc.

From
Junio C Hamano <junkio@cox.net>
Date
May 28, 2007, 20:44 UTC
Message-ID
<7v4plwd6f0.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<87646cx13d.fsf@rho.meyering.net>
Jim Meyering <jim@meyering.net> writes:
Show 18 quoted lines
> Subject: [PATCH] Don't ignore write failure from git-diff, git-log, etc.
> ...
> You can demonstrate this with git's own --version output, too:
> (but git --help detects the failure without this patch)
>
>     $ ./git --version > /dev/full
>     fatal: write failure on standard output: No space left on device
>     [Exit 128]
>
> Note that the fcntl test (for whether the fileno may be closed) is
> required in order to avoid EBADF upon closing an already-closed stdout,
> as would happen for each git command that already closes stdout; I think
> update-index was the one I noticed in the failure of t5400, before I
> added that test.
>
> Also, to be consistent, don't ignore EPIPE write failures.
>
> Signed-off-by: Jim Meyering <jim@meyering.net>

I do not think anybody has much objection about the change to handle_internal_command() in git.c you made. Earlier we relied on exit(3) to close still open filehandles (while ignoring errors), and you made the close explicit in order to detect errors.

But "to be consistent" above is not a very good justification.

In the presense of shells that give "annoying" behaviour (we have to remember that not everybody have enough privilege, expertise, or motivation to update /bin/sh or install their own copy in $HOME/bin/sh), "EPIPE is different from other errors" is a more practical point of view, I'd have to say. IOW, it is not clear if it is a good thing "to be consistent" to begin with.

I would have appreciated if this were two separate patches. I think the EPIPE one is an independent issue. We could even make it a configuration option to ignore EPIPE ;-)

Previous: Petr BaudisNext: Jim Meyering
Message 13 of 29 in “Don't ignore write failure from git-diff, git-log, etc.”
  1. Don't ignore write failure from git-diff, git-log, etc.Jim Meyering, May 26, 2007
  2. Linus TorvaldsMay 26, 2007
  3. Junio C HamanoMay 26, 2007
  4. Nicolas PitreMay 27, 2007
  5. Jim MeyeringMay 27, 2007
  6. Linus TorvaldsMay 27, 2007
  7. Jim MeyeringMay 28, 2007
  8. Marco RoelandMay 28, 2007
  9. Jim MeyeringMay 28, 2007
  10. Marco RoelandMay 28, 2007
  11. Jim MeyeringMay 28, 2007
  12. Petr BaudisMay 28, 2007
  13. Junio C HamanoMay 28, 2007
  14. Jim MeyeringMay 29, 2007
  15. Junio C HamanoMay 29, 2007
  16. Jim MeyeringMay 30, 2007
  17. Linus TorvaldsMay 28, 2007
  18. Jim MeyeringMay 28, 2007
  19. Linus TorvaldsMay 29, 2007
  20. Jim MeyeringMay 29, 2007
  21. Linus TorvaldsMay 29, 2007
  22. Jim MeyeringMay 30, 2007
  23. Linus TorvaldsMay 30, 2007
  24. Jim MeyeringMay 30, 2007
  25. Junio C HamanoMay 28, 2007
  26. Linus TorvaldsMay 29, 2007
  27. Jim MeyeringMay 30, 2007
  28. Junio C HamanoMay 30, 2007
  29. Jim MeyeringMay 30, 2007

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.