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

fsck option to remove corrupt objects - why/why not?

From
BABen Aveling <bena.001@optusnet.com.au>
Date
Oct 16, 2014, 00:13 UTC
Message-ID
<543F0DAE.2050205@optusnet.com.au>
In-Reply-To
<20141015234637.9B4FC781EFB@mail110.syd.optusnet.com.au>
On 14/10/2014 19:21, Jeff King wrote:
Show 5 quoted lines
> On Mon, Oct 13, 2014 at 09:37:27AM +1100, Ben Aveling wrote:
>> A question about fsck - is there a reason it doesn't have an option to
>> delete bad objects?
> If the objects are reachable, then deleting them would create other big
> problems (i.e., we would be breaking the object graph!).
The man page for fsck advises:
    "Any corrupt objects you will have to find in backups or other
    archives (i.e., you can just remove them and do an /rsync/ with some
    other site in the hopes that somebody else has the object you have
    corrupted)."

And that seems sensible to me - the object is corrupt, it is unusable, the object graph is already broken, we already have big problems, removing the corrupt object(s) doesn't create any new problems, and it allows the possibility that the damaged objects can be restored.

I ask because I have a corrupt repository, and every time I run fsck, it reports one corrupt object, then stops. I could write a script to repeatedly call fsck and then remove the next corrupt object, but it raises the question for me; could it make sense to extend fsck with the option to do to the removes? Or even better, do the removes and then do the necessary [r]sync, assuming the user has another repository that has a good copy of the bad objects, which in this case I do.

Regards, Ben
Next: Johan Herland
Message 1 of 6 in “fsck option to remove corrupt objects - why/why not?”
  1. Ben AvelingOct 16, 2014
  2. Johan HerlandOct 16, 2014
  3. Jeff KingOct 16, 2014
  4. Johan HerlandOct 16, 2014
  5. Junio C HamanoOct 16, 2014
  6. Matthieu MoyOct 16, 2014

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.