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

Re: pack corruption post-mortem

From
Shawn Pearce <spearce@spearce.org>
Date
Oct 19, 2013, 19:17 UTC
Message-ID
<CAJo=hJugNGkpDxh6o6azVGc7pP3fTGsK113vRgb4A7ipNeV2ZA@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.03.1310191024000.1951@syhkavp.arg>
On Sat, Oct 19, 2013 at 7:41 AM, Nicolas Pitre <nico@fluxnic.net> wrote:
Show 27 quoted lines
> On Sat, 19 Oct 2013, Duy Nguyen wrote:
>
>> On Wed, Oct 16, 2013 at 3:34 PM, Jeff King <peff@peff.net> wrote:
>> > I was recently presented with a repository with a corrupted packfile,
>> > and was asked if the data was recoverable. This post-mortem describes
>> > the steps I took to investigate and fix the problem. I thought others
>> > might find the process interesting, and it might help somebody in the
>> > same situation.
>> >
>> > I started with an fsck, which found a problem with exactly one object
>> > (I've used $pack and $obj below to keep the output readable, and also
>> > because I'll refer to them later):
>> >
>> >     $ git fsck
>> >     error: $pack SHA1 checksum mismatch
>> >     error: index CRC mismatch for object $obj from $pack at offset 51653873
>> >     error: inflate: data stream error (incorrect data check)
>> >     error: cannot unpack $obj from $pack at offset 51653873
>>
>> I wonder if we should protect the sha-1 and pathname tables in packv4
>> with CRC too. A bit flipped in there could cause stream of corrupt
>> objects and make it hard to pinpoint the corrupt location..
>
> It turns out that we already have this covered.
>
> The SHA1 used in the name of the pack file is actually the SHA1 checksum
> of the SHA1 table.

I continue to believe this naming is wrong. The pack file name should be the SHA1 checksum of the pack data stream, but the SHA1 table. This would allow cleaner update of a repository that was repacked with different compression settings, but identical objects.

Previous: Nicolas PitreNext: Nicolas Pitre
Message 10 of 16 in “pack corruption post-mortem”
  1. Jeff KingOct 16, 2013
  2. Duy NguyenOct 16, 2013
  3. Martin FickOct 16, 2013
  4. Jeff KingOct 17, 2013
  5. Junio C HamanoOct 17, 2013
  6. Jeff KingOct 25, 2013
  7. Duy NguyenOct 17, 2013
  8. Duy NguyenOct 19, 2013
  9. Nicolas PitreOct 19, 2013
  10. Shawn PearceOct 19, 2013
  11. Nicolas PitreOct 20, 2013
  12. Duy NguyenOct 20, 2013
  13. Nicolas PitreOct 20, 2013
  14. howto: document more tools for recovery corruptionJeff King, Apr 1, 2015
  15. Junio C HamanoApr 1, 2015
  16. Jeff KingApr 2, 2015

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.