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

Re: index-pack died on pread

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jul 26, 2007, 16:51 UTC
Message-ID
<81b0412b0707260951h57fc91dbsd5a0a126f0e16fee@mail.gmail.com>
In-Reply-To
<alpine.LFD.0.999.0707260911040.3442@woody.linux-foundation.org>
On 7/26/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:
Show 10 quoted lines
> On Thu, 26 Jul 2007, Alex Riesen wrote:
> > >
> > > It's true that pread() is used much less than normal reads, and maybe the
> > > cygwin pread() is indeed broken. But it's intriguing how apparently both
> > > HP-UX and Cygwin are showing the same breakage.
> >
> > Maybe because neither _has_ POSIX pread?
>
> HP-UX? No pread()? It wouldn't link if it didn't have pread(). So it
> clearly has pread(), it's just somehow broken.
I remember it didn't and was emulated with lseek.
Show 8 quoted lines
> > This is cygwin's pread, I believe:
> >
> > http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/fhandler_disk_file.cc?rev=1.225&content-type=text/x-cvsweb-markup&cvsroot=src
>
> I'm not saying that's great programming, but the "git_pread()" that git
> will use in the absense of a real pread() is actually even *less* of a
> POSIX pread, since it doesn't even try to save/restore the old position
> (it knows that git doesn't care).

Not that. I meant the value read returned wasn't checked nor returned. Suppose read failed (on Windows it happens all the time, especially if you stress it a bit) - you'll never know it did and the buffer will contain either garbage or previous data. Now imagine we _did_ have a past-eof condition or bleeding into sign-bit (because of some 64-bit confusion)...

> So I don't think that explains why git doesn't like cygwin's pread. I
> suspect an earlier version of cygwin had an even more broken version of
> pread at some point.
Yep, that could be another reason.
Previous: Linus TorvaldsNext: Linus Torvalds
Message 11 of 17 in “index-pack died on pread”
  1. Michal RokosJul 23, 2007
  2. Alex RiesenJul 23, 2007
  3. Michal RokosJul 25, 2007
  4. Alex RiesenJul 25, 2007
  5. Linus TorvaldsJul 23, 2007
  6. Nicolas PitreJul 23, 2007
  7. Robin RosenbergJul 25, 2007
  8. Linus TorvaldsJul 25, 2007
  9. Alex RiesenJul 26, 2007
  10. Linus TorvaldsJul 26, 2007
  11. Alex RiesenJul 26, 2007
  12. Linus TorvaldsJul 26, 2007
  13. Junio C HamanoJul 27, 2007
  14. Linus TorvaldsJul 27, 2007
  15. Tomash BrechkoJul 27, 2007
  16. Tomash BrechkoJul 27, 2007
  17. Nicolas PitreJul 27, 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.