"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: teach gotadmin cleanup to remove redundant packfiles
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 18 Jun 2023 16:08:34 +0200

Download raw body.

Thread
On Sun, Jun 18, 2023 at 04:00:22PM +0200, Omar Polo wrote:
> On 2023/06/18 15:33:44 +0200, Stefan Sperling <stsp@stsp.name> wrote:
> > > +	/*
> > > +	 * For compatibility with Git, if a matching .keep file exist
> > > +	 * don't delete the packfile.
> > > +	 */
> > > +	dot = strrchr(path, '.');
> > > +	*dot = '\0';
> > > +	if (strlcat(path, ".keep", sizeof(path)) >= sizeof(path))
> > > +		return got_error(GOT_ERR_NO_SPACE);
> > 
> > Would be nice to use got_error_fmt here to print the overlong path.
> > Because it comes from the filesystem the value is beyond our
> > control and it would suck if someone hit this and couldn't easily
> > figure out which NO_SPACE error case is being hit.
> 
> I'm not sure the return line could ever be hitted.
> 
> The path is of the form object/packs/pack-$hash.idx, then we change
> the .idx with .keep and the other .something.  Hash is guaranteed to
> be a sha1 digest so we can't pratically overflow the buffer.

Indeed, I agree. I missed that these are relative paths rather
than absolute ones.