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

Re: [PATCH] make pack-objects a bit more resilient to repo corruption

From
Nicolas Pitre <nico@fluxnic.net>
Date
Oct 22, 2010, 18:54 UTC
Message-ID
<alpine.LFD.2.00.1010221451340.2764@xanadu.home>
In-Reply-To
<1287761064.31218.37.camel@drew-northup.unet.maine.edu>
On Fri, 22 Oct 2010, Drew Northup wrote:
Show 36 quoted lines
> 
> On Fri, 2010-10-22 at 10:46 -0400, Jeff King wrote:
> > On Fri, Oct 22, 2010 at 12:53:32AM -0400, Nicolas Pitre wrote:
> > 
> > > -		if (!src->data)
> > > +		if (!src->data) {
> > > +			if (src_entry->preferred_base) {
> > > +				/* 
> > > +				 * Those objects are not included in the
> > > +				 * resulting pack.  Be resilient and ignore
> > > +				 * them if they can't be read, in case the
> > > +				 * pack could be created nevertheless.
> > > +				 */
> > > +				return 0;
> > > +			}
> > >  			die("object %s cannot be read",
> > >  			    sha1_to_hex(src_entry->idx.sha1));
> > > +		}
> > 
> > By converting this die() into a silent return, are we losing a place
> > where git might previously have alerted a user to corruption? In this
> > case, we can continue the operation without the object, but if we have
> > detected corruption, letting the user know as soon as possible is
> > probably a good idea.
> > 
> > In other words, should this instead be:
> > 
> >   warning("unable to read preferred base object: %s", ...);
> >   return 0;
> > 
> > Or will some other part of the code already complained to stderr?
> > 
> > -Peff
> 
> Agreed. If it broke we should probably tell the user--even if we can't
> do much useful about it other than attempt to recover by continuing.

Please don't misinterpret this case. As far as this change is concerned, nothing is actually "broken". The operation _will_ still succeed. The repository may be broken, but in this case we can do without the broken object. In those cases where the object is really needed the original die() is still in place.

Nicolas
Previous: Drew NorthupNext: Nicolas Pitre
Message 4 of 11 in “make pack-objects a bit more resilient to repo corruption”
  1. make pack-objects a bit more resilient to repo corruptionNicolas Pitre, Oct 22, 2010
  2. Jeff KingOct 22, 2010
  3. Drew NorthupOct 22, 2010
  4. Nicolas PitreOct 22, 2010
  5. Nicolas PitreOct 22, 2010
  6. make pack-objects a bit more resilient to repo corruptionNicolas Pitre, Oct 22, 2010
  7. Sverre RabbelierOct 22, 2010
  8. Nicolas PitreOct 22, 2010
  9. Junio C HamanoOct 22, 2010
  10. Geert BoschOct 24, 2010
  11. Nicolas PitreOct 24, 2010

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.