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

Re: pack corruption post-mortem

From
Nicolas Pitre <nico@fluxnic.net>
Date
Oct 20, 2013, 21:08 UTC
Message-ID
<alpine.LFD.2.03.1310201657210.1951@syhkavp.arg>
In-Reply-To
<CACsJy8AATr9KfFN6x0E8mYsBmWhVmD=kaXgBmnFTiyww3MS8WQ@mail.gmail.com>
On Sun, 20 Oct 2013, Duy Nguyen wrote:
Show 20 quoted lines
> On Sat, Oct 19, 2013 at 9:41 PM, Nicolas Pitre <nico@fluxnic.net> wrote:
> > On Sat, 19 Oct 2013, Duy Nguyen wrote:
> > The SHA1 used in the name of the pack file is actually the SHA1 checksum
> > of the SHA1 table.
> >
> > The path and ident tables are already protected by the CRC32 in the zlib
> > deflated stream.
> >
> > Normal objects are also zlib deflated (except for their header) but you
> > need to inflate them in order to have this CRC verified, which the pack
> > data copy tries to avoid.  Hence the separate CRC32 in the index file in
> > that case.
> 
> OK slight change in the subject, what about reading code (i.e.
> sha1_file.c)? With v2 crc32 is verified by object inflate code. With
> v4 trees or commits, because we store some (or all) data outside of
> the deflated stream, we will not benefit from crc32 verifcation
> previously done for all trees and commits. Should we perform explict
> crc32 check when reading v4 trees and commits (and maybe verify the
> sha-1 table too)?
I suppose that we should... at some point.

I did the SHA1 table check only for index-pack and unpack-objects in my latest patch. Adding it to check_packed_git_idx() as well should be trivial.

I'm not sure about the best way to do systematic checks on tree objects though. We have both the CRC32 recorded in the index file and the object SHA1 recorded in the SHA1 table. But any of them needs to be computed as we walk the object and we currently havn't found the best way to do that yet. So I'd suggest postponing this until the tree walk is properly implemented to perform well first.

Nicolas
Previous: Duy NguyenNext: Jeff King
Message 13 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.