[Bug 1347814] Re: git-gc can damage a repository

Sworddragon 1347814 at bugs.launchpad.net
Thu Jul 24 07:28:17 UTC 2014


> Okay. Do you still think this is a bug?

On testing it a little more I have figured out that I have made an error
on creating the testcase that let me think that the repository doesn't
get damaged. Here is now a testcase that natively damages a repository:

1. Make sure your user has an umask of 077 (for example by replacing #022 with 077 in ~/.profile and probably by loging out and in again).
2. Download a repository (for example I'm testing with "git clone git://git.code.sf.net/p/tvoip/code tvoip").
3. Change into the directory of the repository.
3. Call "git log" to validate that the repository is currently undamaged.
4. Instead of calling git-gc the repository gets optimized more manually with 'sudo bash -c "git pack-refs --all; git reflog expire --all --expire-unreachable=now --expire=now; git repack --depth 250 --window 250 -Fad; git rerere gc; git prune --expire now"'.
5. Call the same command without sudo (an error should appear).
6. Call "sudo git log" to see that no commits are available anymore.

** Changed in: git (Ubuntu)
       Status: Incomplete => New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to git in Ubuntu.
https://bugs.launchpad.net/bugs/1347814

Title:
  git-gc can damage a repository

Status in “git” package in Ubuntu:
  New

Bug description:
  I'm using Ubuntu 14.10 dev with git 1:2.0.1-1 and if git-gc hasn't
  full write-access to a repository it can damage it. Getting such a
  permission state for a git repository isn't even unlikely if it was
  optimized in a sudo environment before. Here is an example output:

  sworddragon at ubuntu:~/.git/tvoip$ sudo git gc --aggressive --prune=now
  Counting objects: 1250, done.
  Delta compression using up to 6 threads.
  Compressing objects: 100% (1220/1220), done.
  Writing objects: 100% (1250/1250), done.
  Total 1250 (delta 944), reused 295 (delta 0)
  sworddragon at ubuntu:~/.git/tvoip$ git gc --aggressive --prune=now
  fatal: internal error: packed-ref cache cleared while locked
  error: failed to run pack-refs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/git/+bug/1347814/+subscriptions



More information about the foundations-bugs mailing list