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

Re: [PATCH] git-rev-list: give better diagnostic for failed write

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jun 25, 2007, 20:59 UTC
Message-ID
<alpine.LFD.0.98.0706251349540.8675@woody.linux-foundation.org>
In-Reply-To
<87r6nzu666.fsf@rho.meyering.net>
On Mon, 25 Jun 2007, Jim Meyering wrote:
Show 6 quoted lines
>
> [this patch depends on the one I posted here:
>  http://marc.info/?l=git&m=118280134031923&w=2 ]
> 
> Without this patch, git-rev-list unnecessarily omits strerror(errno)
> from its diagnostic, upon write failure:
And this is a perfect example of what's wrong with the whole thing.
Dammit, how many times do I need to say this:
 - If you want reliable errors, don't use stdio!

That fflush is there FOR A REASON. You removed it FOR A MUCH LESS IMPORTANT REASON!

That fflush is there exactly because WE DO NOT WANT TO BUFFER the list of commits, because that thing is meant very much to be used for pipelines, and it's quite common that the receiving end is going to do something asynchronous with the result, and can - and does - want the results as soon as possible.

IOW, things like "gitk" use git-rev-list exactly to get the list of commits, and they want that list *incrementally*. They don't want to wait for git-rev-list to have filled up some 8kB buffer of commits. Especially since generating those commits can be slow if we're talking about a big tree and some path-limited stuff.

So for example, do something like
	git rev-list HEAD -- drivers/char/drm/Makefile

and if you don't see the result scroll a line at a time on a slower machine, there's something *wrong*.

Junio, I'm NAK'ing this very forcefully!
Jim: I don't know what I'm doing wrong, but I'm apparently not reaching 
you. So let me try one more time:
 - stdio really isn't very good with error handling
 - if you use stdio, YOU HAD BETTER ACCEPT THAT
 - don't screw up basic functionality in your *insane* quest to get stdio 
   to give you ENOSPC. It's not going to happen. Not that way. Just face 
   the fact that stdio *will* throw error numbers away.

The whole notion of "buffered IO" and "reliable errors" is simply not something that goes well together.

			Linus
Previous: Jim MeyeringNext: Jim Meyering
Message 2 of 33 in “git-rev-list: give better diagnostic for failed write”
  1. git-rev-list: give better diagnostic for failed writeJim Meyering, Jun 25, 2007
  2. Linus TorvaldsJun 25, 2007
  3. Jim MeyeringJun 25, 2007
  4. Linus TorvaldsJun 25, 2007
  5. Linus TorvaldsJun 25, 2007
  6. Linus TorvaldsJun 25, 2007
  7. Jim MeyeringJun 27, 2007
  8. Linus TorvaldsJun 25, 2007
  9. Theodore TsoJun 26, 2007
  10. Linus TorvaldsJun 26, 2007
  11. Theodore TsoJun 26, 2007
  12. Linus TorvaldsJun 26, 2007
  13. Theodore TsoJun 28, 2007
  14. Jeff KingJun 28, 2007
  15. Don't fflush(stdout) when it's not helpfulTheodore Tso, Jun 28, 2007
  16. Frank LichtenheldJun 29, 2007
  17. Theodore TsoJun 29, 2007
  18. Jeff KingJun 29, 2007
  19. Junio C HamanoJun 29, 2007
  20. Linus TorvaldsJun 29, 2007
  21. Theodore TsoJun 29, 2007
  22. Linus TorvaldsJun 29, 2007
  23. Junio C HamanoJun 30, 2007
  24. Linus TorvaldsJun 30, 2007
  25. Theodore TsoJun 30, 2007
  26. Junio C HamanoJun 30, 2007
  27. Jeff KingJun 26, 2007
  28. Linus TorvaldsJun 26, 2007
  29. Jim MeyeringJun 27, 2007
  30. Linus TorvaldsJun 27, 2007
  31. Jim MeyeringJun 25, 2007
  32. Linus TorvaldsJun 25, 2007
  33. Jim MeyeringJun 25, 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.