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

Re: git repack leaks disk space on ENOSPC

From
Jeff King <peff@peff.net>
Date
Oct 12, 2017, 13:36 UTC
Message-ID
<20171012133636.isvg5typrputvxmm@sigill.intra.peff.net>
In-Reply-To
<20171012093439.GD32090@inner.h.apk.li>
On Thu, Oct 12, 2017 at 11:34:39AM +0200, Andreas Krey wrote:
Show 9 quoted lines
> > Does using create_tempfile there seem like a good path forward to you?
> > Would you be interested in working on it (either writing a patch with
> > such a fix or a test in t/ to make sure it keeps working)?
> 
> I will look into creating a patch (thanks for the pointers),
> but I don't see how to make a testcase for this - pre-filling the
> disk doesn't sound like a good idea. Most people probably won't run in
> this situation, and then won't have tmp_packs with a dozen GBytes each
> lying around.

It may be easier to trigger a case which rejects the pack for other reasons. For an incoming index-pack, turning on transfer.fsckObjects is an easy one. For a repack, perhaps corrupting a loose object to-be-packed would work.

E.g.:
  git init
  echo content >file
  git add file
  git commit -m foo
  # corrupt the blob in a subtle way
  obj=.git/objects/$(git rev-parse HEAD:file | sed 's,..,&/,')
  chmod +w $obj
  echo cruft >>$obj
After that, I get:
  $ git repack -ad
  Counting objects: 3, done.
  error: garbage at end of loose object 'd95f3ad14dee633a758d2e331151e950dd13e4ed'
  fatal: loose object d95f3ad14dee633a758d2e331151e950dd13e4ed (stored in .git/objects/d9/5f3ad14dee633a758d2e331151e950dd13e4ed) is corrupt
  $ find -type f .git/objects/pack
  .git/objects/pack/tmp_pack_0GaXwk
-Peff
Previous: brian m. carlsonNext: Jeff King
Message 5 of 6 in “git repack leaks disk space on ENOSPC”
  1. Andreas KreyOct 11, 2017
  2. Jonathan NiederOct 12, 2017
  3. Andreas KreyOct 12, 2017
  4. brian m. carlsonOct 12, 2017
  5. Jeff KingOct 12, 2017
  6. Jeff KingOct 12, 2017

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.