Re: v2.15.0-rc2 ref deletion bug
- From
Jeff King <peff@peff.net>
- Date
- Oct 24, 2017, 19:04 UTC
- Message-ID
- <20171024190411.dvv7zsq6ax4nndti@sigill.intra.peff.net>
- In-Reply-To
- <ea715dae-b410-d4fb-77c7-2e61b764a343@alum.mit.edu>
On Tue, Oct 24, 2017 at 01:05:00PM +0200, Michael Haggerty wrote:
Show 16 quoted lines
> > I'd expect one of: > > > > 1. We delete "foo" before updating "foo/bar", and we end up with a > > single ref. > > I don't think that this is possible in the general case in a single > transaction. The problem is that the code would need to take locks > > refs/tags/foo.lock > refs/tags/foo/bar.lock > > But the latter couldn't coexist with the loose reference file > > refs/tags/foo > > , which might already exist.
Yeah, you're right. I was thinking of the opposite case (where you could create "foo.lock" even though "foo/bar" exists), but this one is impossible with filesystem semantics.
Show 6 quoted lines
> It is only imaginable to do this in a single transaction if you pack and > prune `refs/tags/foo` first, to get the loose reference out of the way, > before executing the transaction. Even then, you would have to beware of > a race where another process writes a loose version of `refs/tags/foo` > between the time that `pack-refs` prunes it and the time that the > transaction obtains the lock again.
Yeah, it's probably better to avoid playing games here. Moving to a non-filesystem storage backend would just make the problem go away.
-Peff