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

detect write failure, even for stdout

From
Jim Meyering <jim@meyering.net>
Date
May 22, 2006, 10:27 UTC
Message-ID
<87d5e6gxr0.fsf_-_@rho.meyering.net>
In-Reply-To
<7v3bf3jl15.fsf@assigned-by-dhcp.cox.net>

git doesn't always detect write failures. A write I/O error, (e.g., hardware I/O error or simply disk full) doesn't provoke nonzero exit status:

    $ ./git-cat-file -t HEAD > /dev/full && echo did not detect write failure
    did not detect write failure

This is perhaps more important than the other things I've reported, since it can lead to porcelain being unable to detect a real failure in the plumbing.

Here are two more:
    $ ./git-ls-tree HEAD > /dev/full && echo fail
    fail
    $ ./git-show > /dev/full && echo fail
    fail
If you were using gnulib, I'd suggest simply adding this line
    atexit (close_stdout);

near the beginning of each `main'. Then you wouldn't have to manually track down each and every place where a write to stdout can occur -- not to mention the maintenance burden of keeping things correct as the code evolves.

Previous: Morten Welinder
Message 20 of 20 in “synchronizing incremental git changes to cvs”
  1. Jim MeyeringMay 20, 2006
  2. Johannes SchindelinMay 20, 2006
  3. Jim MeyeringMay 21, 2006
  4. Pavel RoskinMay 22, 2006
  5. Jakub NarebskiMay 22, 2006
  6. Martin LanghoffMay 21, 2006
  7. Jim MeyeringMay 21, 2006
  8. Junio C HamanoMay 21, 2006
  9. Jim MeyeringMay 21, 2006
  10. don't accept bogus N in `HEAD~N'Jim Meyering, May 21, 2006
  11. Jakub NarebskiMay 21, 2006
  12. Jim MeyeringMay 22, 2006
  13. Junio C HamanoMay 22, 2006
  14. Junio C HamanoMay 22, 2006
  15. avoid atoi, when possible; int overflow -> heap corruptionJim Meyering, May 22, 2006
  16. Morten WelinderMay 22, 2006
  17. Jim MeyeringMay 22, 2006
  18. Jeff KingMay 22, 2006
  19. Morten WelinderMay 22, 2006
  20. detect write failure, even for stdoutJim Meyering, May 22, 2006

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.