Subject: Re: [PATCH] fsck: do not crash on tag objects which do not contain an empty line

From: Johan Herland <[email-masked]>
Date: Fri, 08 Jun 2007 01:28:48 +0200

On Friday 08 June 2007, Johannes Schindelin wrote:
> Hi,
> 
> On Fri, 8 Jun 2007, Johan Herland wrote:
> 
> > On Friday 08 June 2007, Johannes Schindelin wrote:
> > > 
> > > The first empty line in a tag object separates the header from the 
> > > message. If the tag object has no empty line, do not crash, but 
> > > complain loudly instead.
> > 
> > Aren't tag objects _required_ to have an empty line separating the 
> > headers from the body? At least I wrote the new tag code with that 
> > assumption in mind.
> 
> Yes, evidently you did.
> 
> But even then, isn't it always better to not rely on such assumptions, but 
> fail gracefully? The rest of Git's source code seems to be nicer to 
> failures as this one, IMHO.

I agree that we should fail gracefully, and my code is clearly not doing 
that in this case. My bad.

But the code should also detect invalid tag objects, and in this case I'm 
not yet convinced that the tag object causing the failure is in fact valid. 
If someone can convince me that the blank line after headers is optional, 
then I'll gladly fix the code.

> > Could this be related to the "error: char103: premature end of data" 
> > you're seeing?
> 
> Definitely. It breaks even _fetching_.

Sorry again. Still, if I could get a look at the object that'd help me alot 
in debugging.

...Johan

-- 
Johan Herland, <[email-masked]>
www.herland.net