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

[JGit] Mismatch CRC in packed objects from `jgit push`

From
Daniel Cheng <j16sdiz+freenet@gmail.com>
Date
Mar 24, 2009, 02:53 UTC
Message-ID
<ff6a9c820903231953q29a5ccbk8e5b54c9afdb8abd@mail.gmail.com>
Hi list,

When I working with jgit-over-freenet, I found the pack files as generated by `jgit push` give CRC error in `git fsck` and `git clone`, but they are perfectly okay if I do a `git unpack-objects` manually.

You can download the pack file here:
 http://sdiz.net/temp/pack-fcedfaa7130866c884e208769661360563a3081f.idx
 http://sdiz.net/temp/pack-fcedfaa7130866c884e208769661360563a3081f.pack
Here is the diagnose session:
sdiz@sp2:/tmp$ git clone --verbose http://........
[...]
Getting index for pack fcedfaa7130866c884e208769661360563a3081f
Getting pack fcedfaa7130866c884e208769661360563a3081f
 which contains f197d4578a1b8ed195981d1e1ad4c390875c353a
error: index CRC mismatch for object
f197d4578a1b8ed195981d1e1ad4c390875c353a from
/tmp/egit-freenet/.git/objects/pack/pack-fcedfaa7130866c884e208769661360563a3081f.pack
at offset 12
error: index CRC mismatch for object
0b2cb180fef969e0da259765564f9bf8bcd8cf25 from
/tmp/egit-freenet/.git/objects/pack/pack-fcedfaa7130866c884e208769661360563a3081f.pack
at offset 183
error: index CRC mismatch for object
d88f5a430841925629c30199e666473d201bdf5a from
/tmp/egit-freenet/.git/objects/pack/pack-fcedfaa7130866c884e208769661360563a3081f.pack
at offset 379
error: index CRC mismatch for object
40d3204c679fc5d25281331b981d968016030930 from
/tmp/egit-freenet/.git/objects/pack/pack-fcedfaa7130866c884e208769661360563a3081f.pack
at offset 558
[...]
sdiz@sp2:/tmp$ git --version
git version 1.6.2
// Using the pack file directly seems okay, but fsck give the CRC error :
sdiz@sp2:/tmp/z$ git init
Initialized empty Git repository in /tmp/z/.git/
sdiz@sp2:/tmp/z$ cp ../pack-* .git/objects/pack/
sdiz@sp2:/tmp/z$ git checkout f197d4578a1b8ed195981d1e1ad4c390875c353a
warning: You appear to be on a branch yet to be born.
warning: Forcing checkout of f197d4578a1b8ed195981d1e1ad4c390875c353a.
Note: moving to "f197d4578a1b8ed195981d1e1ad4c390875c353a" which isn't
a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
HEAD is now at f197d45... Instruction for cloning with git+fproxy
sdiz@sp2:/tmp/z$ ls
0x7494252.asc  activelink.png  freenet-bunny.svg  index.html  jgit
jgit.jar  jgit_src.zip
sdiz@sp2:/tmp/z$
sdiz@sp2:/tmp/z$ git fsck f197d4578a1b8ed195981d1e1ad4c390875c353a
error: index CRC mismatch for object
f197d4578a1b8ed195981d1e1ad4c390875c353a from
.git/objects/pack/pack-fcedfaa7130866c884e208769661360563a3081f.pack
at offset 12
error: index CRC mismatch for object
0b2cb180fef969e0da259765564f9bf8bcd8cf25 from
.git/objects/pack/pack-fcedfaa7130866c884e208769661360563a3081f.pack
at offset 183
error: index CRC mismatch for object
d88f5a430841925629c30199e666473d201bdf5a from
.git/objects/pack/pack-fcedfaa7130866c884e208769661360563a3081f.pack
at offset 379
[...]

// unpack the objects manually seems to fix the issue sdiz@sp2:/tmp/z$ rm -f .git/objects/*/* sdiz@sp2:/tmp/z$ git unpack-objects --strict -r < ../pack-fcedfaa7130866c884e208769661360563a3081f.pack Unpacking objects: 100% (26/26), done. sdiz@sp2:/tmp/z$ git fsck --full f197d4578a1b8ed195981d1e1a sdiz@sp2:/tmp/z$

// diff'ing the checkout with the original repository is also okay sdiz@sp2:/tmp/z$ diff -Nau ~/build/egit/ . Common subdirectories: /home/sdiz/build/egit/.git and ./.git sdiz@sp2:/tmp/z$

// Fsck'ing in original repository is perfectly okay:

sdiz@sp2:~/build/egit$ git fsck --full f197d4 dangling commit 9900ac0df33e046c2f3f77ad8e084d535d3c023d dangling commit 2e12ce6571923190124e86cc6b877ccb3ace9219 dangling commit f8150b71a352176f672270ffced6958682b215f3 dangling commit 101ae6bff9ca647c7c8297556314757162fbc2f2 [..]

Next: Daniel Cheng (aka SDiZ)
Message 1 of 7 in “[JGit] Mismatch CRC in packed objects from `jgit push`”
  1. Daniel ChengMar 24, 2009
  2. [JGIT Test Case] This (incomplete) test case demo the index wrong CRC bug.Daniel Cheng (aka SDiZ), Mar 24, 2009
  3. 1/2 Calculate CRC32 on Pack Index v2Daniel Cheng (aka SDiZ), Mar 25, 2009
  4. 2/2 Test case for pack index CRCDaniel Cheng (aka SDiZ), Mar 25, 2009
  5. Marek ZawirskiMar 25, 2009
  6. Shawn O. PearceMar 25, 2009
  7. Daniel ChengMar 26, 2009

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.