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

Re: [PATCH 2/2] pack-objects: be incredibly anal about stdio semantics

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 2, 2006, 22:58 UTC
Message-ID
<Pine.LNX.4.64.0604021554480.23419@g5.osdl.org>
In-Reply-To
<15051.1144015974@lotus.CS.Berkeley.EDU>
On Sun, 2 Apr 2006, Jason Riedy wrote:
Show 5 quoted lines
> 
> If you consider stdio to be a low-level wrapper over syscalls
> that only adds buffering and simple parsing, then passing EINTR
> back to the application is a sensible choice.  I wouldn't be
> too surprised if L4, VxWorks, etc. do something similar.

No, returning EINTR is insane, because stdio has to do re-starting of system calls by hand _anyway_ for the "short read" case.

EINTR really _is_ 100% equivalent to "short read of zero bytes" (that literally is what it means for a read/write system call - anybody who tells you otherwise is just crazy).

So any library that handles short reads, but doesn't handle EINTR is by definition doing something totally idiotic and broken.

Now, I agree that somebody else might be broken too. I would not agree that it's "acceptable". It's craptastically bad library code.

> Anyone with an older HP/UX care to try these patches?  HP/UX 
> may not be sane, but I think it may lack SA_RESTART.  I don't 
> know if stdio calls need restarted, though.

I'd assume that older HPUX is so BSD-based that all signals end up restarting. That was the BSD signal() semantics, after all.

			Linus
Previous: Jason RiedyNext: Jason Riedy
Message 12 of 20 in “Solaris cloning woes partly diagnosed”
  1. Junio C HamanoApr 2, 2006
  2. Linus TorvaldsApr 2, 2006
  3. Jason RiedyApr 2, 2006
  4. Linus TorvaldsApr 2, 2006
  5. Linus TorvaldsApr 2, 2006
  6. Jason RiedyApr 2, 2006
  7. Linus TorvaldsApr 2, 2006
  8. 2/2 pack-objects: be incredibly anal about stdio semanticsLinus Torvalds, Apr 2, 2006
  9. Junio C HamanoApr 2, 2006
  10. Linus TorvaldsApr 2, 2006
  11. Jason RiedyApr 2, 2006
  12. Linus TorvaldsApr 2, 2006
  13. Use sigaction and SA_RESTART in read-tree.c; add option in Makefile.Jason Riedy, Apr 2, 2006
  14. Linus TorvaldsApr 3, 2006
  15. Junio C HamanoApr 3, 2006
  16. Linus TorvaldsApr 3, 2006
  17. Linus TorvaldsApr 3, 2006
  18. H. Peter AnvinApr 4, 2006
  19. [RFH] Solaris cloning woes...Junio C Hamano, Apr 4, 2006
  20. Jason RiedyApr 4, 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.