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

Re: Error converting from 1.4.4.1 to 1.5.0?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 14, 2007, 18:19 UTC
Message-ID
<Pine.LNX.4.64.0702140958440.3604@woody.linux-foundation.org>
In-Reply-To
<17875.17647.74882.218627@lisa.zopyra.com>
On Wed, 14 Feb 2007, Bill Lear wrote:
>
> % git fsck-objects --full
> error: Packfile .git/objects/pack/pack-23d1a9af78b4b78d1f3750cf70f83cb91a20ba64.pack SHA1 mismatch with itself

This in itself could have been due to a historical buglet that shouldn't matter (SHA1 on pack-files got miscomputed). However, that's probably NOT the problem, since:

> fatal: failed to find delta-pack base object 90bad0d280a6d7c155bbd9582b35ffcf5e3bdd27
implies that the pack really is corrupt.

Even a single-bit error will corrupt a pack in bad ways, which is one reason why we're so careful with it and add its own SHA1 to the end.

The best way to proceed:
 - MAKE A BACKUP ("tar" up everything). If for no other reason than
   (a) then you don't have to worry about making things worse even by 
       mistake
   (b) it might be interesting for others (if you can make those 
       pack-files available) to try to figure out what exactly the 
       corruption was. We've done it before, when it turned out to be a 
       single-bit error.
 - if you have other git archives or just back-ups of everything, just use 
   them, and throw the corrupt one away entirely (but see above on why 
   it's nice to have an archive of the corruption for posterity anyway)
 - if you don't, you can try "git unpack-objects -r". See the man-page on 
   why you need to first _move_ the pack-file away:
	mv <bad-pack-file> .git/bad-pack.pack
	mv <bad-pack-index> .git/bad-index.index
	git unpack-objects -r < .git/bad-pack.pack
   this will unpack as many objects into loose format as it can. Hopefully 
   you haven't lost much.
 - after that, the ones that you *did* lose, you can hopefully find in 
   older git repos: even if you didn't have the *full* new repo anywhere 
   else, other git repositories may have the particular objects that got 
   corrupted. "git fsck" will tell you what is missing, and you can just 
   point your .git/info/alternates file at other repositories to "steal" 
   objects from automatically.
 - if you aren't missing any objects after that, you can now repack the 
   repository, and then remove the alternates file:
	git repack -a -d
	rm .git/info/alternates
   because the repack will steal all the objects you need, and thus you 
   don't need alternates any more.
Finally: it would be very interesting to hear if you do something strange 
or unusual that could have made your chances of getting corruption higher.

Have you ever seen random SIGSEV's or strange oopses, which could be a sign of memory corruption on your machine? Do you do a lot of things over NFS? (which really can corrupt things, especially in circumstances with dodgy ethernet chips: the UDP checksums are very weak, and some ethernet cards do not do a good job of checking the ethernet CRC's!).

> So, all I did was try to do a commit with the new git ... haven't
> recloned, or pulled from upstream...

Yes, don't do anything more (certainly do *not* repack or anything) until you have tarred up and saved the current state, and then only _after_ you have a good safe archive to restart from, try to fix it up.

And if you can make the git history available to outsiders, I'd love to see the corrupt tar-file (it doesn't have to be *public*, if you just can trust me and perhaps a few other people with the data).

So far, as far as I can recall, we've certainly had people screw up their own trees by mistake, but apart from that kind of "user error" things, the only real corruption I recall was the single-bit error in a pack-file. We were able to recover that, but in general, for safety, the best way to protect your data is to replicate it across multiple independent machines (something that git is _good_ at, happily).

		Linus
Previous: Junio C HamanoNext: Linus Torvalds
Message 36 of 39 in “Error converting from 1.4.4.1 to 1.5.0?”
  1. Bill LearFeb 14, 2007
  2. Bill LearFeb 14, 2007
  3. Junio C HamanoFeb 14, 2007
  4. Bill LearFeb 14, 2007
  5. Junio C HamanoFeb 14, 2007
  6. Bill LearFeb 14, 2007
  7. Bill LearFeb 14, 2007
  8. Linus TorvaldsFeb 14, 2007
  9. Bill LearFeb 14, 2007
  10. Junio C HamanoFeb 14, 2007
  11. Junio C HamanoFeb 14, 2007
  12. Johannes SchindelinFeb 14, 2007
  13. Junio C HamanoFeb 14, 2007
  14. Johannes SchindelinFeb 14, 2007
  15. Jakub NarebskiFeb 15, 2007
  16. Olivier GalibertFeb 15, 2007
  17. Johannes SchindelinFeb 15, 2007
  18. Johannes SchindelinFeb 14, 2007
  19. Nicolas PitreFeb 14, 2007
  20. Bill LearFeb 14, 2007
  21. OT: data destruction classics (was: Re: Error converting from 1.4.4.1 to 1.5.0?)Simon 'corecode' Schubert, Feb 15, 2007
  22. Shawn O. PearceFeb 15, 2007
  23. Linus TorvaldsFeb 15, 2007
  24. Johannes SchindelinFeb 15, 2007
  25. Michael K. EdwardsFeb 15, 2007
  26. Bill LearFeb 15, 2007
  27. Andy ParkinsFeb 15, 2007
  28. Mark WoodingFeb 15, 2007
  29. Linus TorvaldsFeb 14, 2007
  30. Linus TorvaldsFeb 14, 2007
  31. Uwe Kleine-KönigFeb 15, 2007
  32. Junio C HamanoFeb 14, 2007
  33. Bill LearFeb 14, 2007
  34. Nicolas PitreFeb 14, 2007
  35. Junio C HamanoFeb 14, 2007
  36. Linus TorvaldsFeb 14, 2007
  37. Linus TorvaldsFeb 14, 2007
  38. Bill LearFeb 14, 2007
  39. Linus TorvaldsFeb 14, 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.