Sinatra: Cloning fails due to zero-padded file modes

Created on 7 Jun 2017  路  7Comments  路  Source: sinatra/sinatra

I tried to clone the project but it does always fails. There seems to be an issue with the integrity of the git repo.

I also tried forking it (worked) and then cloning it (same issue).

$> git clone [email protected]:sinatra/sinatra.git
Cloning into 'sinatra'...
remote: Counting objects: 19910, done.
error: object 218b8c8019a785b8c08c1dd64beff68af63cc1f9: zeroPaddedFilemode: contains zero-padded file modes
fatal: Error in object
fatal: index-pack failed
bug

Most helpful comment

fsck my life

All 7 comments

I just tried it and it did work.

devbox@ubuntu-server-xenial:~/code$ git --version
git version 2.7.4
devbox@ubuntu-server-xenial:~/code$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:    16.04
Codename:   xenial
devbox@ubuntu-server-xenial:~/code$ git clone [email protected]:sinatra/sinatra.git
Cloning into 'sinatra'...
Host key fingerprint is SHA256:n6E5SYUpJ7E1IGOCspRoThXkTxdCKGlwmARLviWbg68
+---[RSA 2048]----+
| =+o...+=o..     |
|o++... *o .      |
|*.o.  *o.        |
|oo.  ..o.= .     |
|.+o. .. S =      |
|*=+ .  o = .     |
|OE .  . o        |
| o     .         |
|                 |
+----[SHA256]-----+
remote: Counting objects: 19910, done.
remote: Total 19910 (delta 0), reused 0 (delta 0), pack-reused 19910
Receiving objects: 100% (19910/19910), 5.92 MiB | 0 bytes/s, done.
Resolving deltas: 100% (10750/10750), done.
Checking connectivity... done.
devbox@ubuntu-server-xenial:~/code$ 

What version of git are you using?

git version 2.13.0 on macOS Sierra

(just tried again, still the same issue)

In my .gitconfig I have the setting:

[transfer]
  fsckobjects = true

When I change this to false I can clone the repo. Running git fsck yields following results:

$> git fsck
Checking object directories: 100% (256/256), done.
warning in tree 218b8c8019a785b8c08c1dd64beff68af63cc1f9: zeroPaddedFilemode: contains zero-padded file modes
warning in tree 496479ab009c76d3d5e5b5eb8f05e478555b730a: zeroPaddedFilemode: contains zero-padded file modes
warning in tree 6720ac897243912cf384731c42a6ed4005bc384c: zeroPaddedFilemode: contains zero-padded file modes
Checking objects: 100% (19910/19910), done.

In case one of the maintainers is interested in fixing this, maybe this contains some hints:
https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F

Yes, it is showing as corrupt for me as well. Why does git not default to fsckobjects I wonder ...

fsck my life

Looks like this was first encountered in https://github.com/sinatra/sinatra/issues/532 (2012!).

I was able to fix it by following the steps in this StackOverflow answer. However, this ends up rewriting a huge chunk of the repo's history, since the broken SHAs are pretty old.

I also had to convert a bunch of signed tags to unsigned, because of the SHA changes.

Here's the updated repository: https://github.com/rohitpaulk/sinatra-gitfsck

The steps I took were:

  • Clone this repository
  • Make a directory for the new repository, run git init
  • From within the old repository:
git fast-export --all --signed-tags=warn-strip | (cd ../new-sinatra && git fast-import)

Other instances of this in the wild:

One possible cause for this bug is in Grit, that was fixed a long time ago.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fullofcaffeine picture fullofcaffeine  路  7Comments

paulmenzel picture paulmenzel  路  4Comments

Joshfindit picture Joshfindit  路  8Comments

za3k picture za3k  路  5Comments

namusyaka picture namusyaka  路  3Comments