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

Re: index-pack died on pread

From
Nicolas Pitre <nico@cam.org>
Date
Jul 23, 2007, 18:03 UTC
Message-ID
<alpine.LFD.0.999.0707231349160.6355@xanadu.home>
In-Reply-To
<alpine.LFD.0.999.0707230956390.3607@woody.linux-foundation.org>
On Mon, 23 Jul 2007, Linus Torvalds wrote:
Show 25 quoted lines
> 
> 
> On Mon, 23 Jul 2007, Michal Rokos wrote:
> >
> > fatal: cannot pread pack file: No such file or directory (n=0,
> > errno=2, fd=3, ptr=40452958, len=428, rdy=0, off=123601)
> 
> Ok, that's bogus. When "n" is zero, the errno (and thus the error string) 
> is not changed by pread, so that's a very misleading error report.
> 
> So what seems to have happened is that the pack-file is too short, so we 
> got a return value of 0, and then reported it as if it had an errno.
> 
> The reason for returning zero from pread would be:
> 
>  - broken pread. I don't think HPUX should be a problem, so that's 
>    probably not it.
> 
>  - the pack-file got truncated
> 
>  - the offset is corrupt, and points to beyond the size of the packfile.
> 
> In this case, since the offset is just 123601, I suspect it's a truncation 
> issue, and your pack-file is simply corrupt. Either because of some 
> problem with receiving it, or because of problems on the remote side.

I doubt it can be that. pread() is always used on pack data that we already received and validated, and part of the validation is the final pack SHA1. No code path leads to pread() before the final pack SHA1 is tested OK.

The only way for the received pack to be truncated and pread() to fail is if write_or_die() somehow failed to write the pack data without Git noticing.

Nicolas
Previous: Linus TorvaldsNext: Robin Rosenberg
Message 6 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.