Re: [PATCH v2 5/5] Reftable support for git-core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, January 29, 2020 3:12:59 AM MST Jeff King wrote:
> On Tue, Jan 28, 2020 at 08:36:53AM -0700, Martin Fick wrote:
> > > There's a slight downside in that tools which _aren't_ careful about
> > > repositoryformatversion might try to operate on the repository, writing
> > > into refs/ or whatever. But such tools are broken, and I'm not sure we
> > > should be catering to them (besides which, the packed-refs ship sailed
> > > long ago, so they're already potentially dangerous).
> > 
> > Could you elaborate on this a bit because it seems on the surface that
> > these tools aren't very dangerous, and therefore likely many of them
> > exist?
> > 
> > What are the dangers today of tools that understand/operate on loose and
> > packed refs without reading repositoryformatversion?
> 
> I was mostly thinking of hacky scripts that tried to touch .git/refs
> directly. And there are a few levels of dangerous there:
> 
>   - if you're doing "echo $sha1 >.git/refs/heads/master", then you're
>     not locking properly. But it would probably work most of the time.
> 
>   - if you're properly taking a lock on ".git/refs/heads/master.lock"
>     and renaming into place but not looking at packed-refs, then you
>     might overwrite somebody else's update which is in the packed file
> 
>   - if you're trying to read refs and not reading packed-refs, obviously
>     you might miss some values
> 
> If you're actually doing the correct locking and packed-refs read (which
> "real" implementations like libgit2 do) then no, I don't think that's
> dangerous. And I think libgit2 properly complains when it sees a
> repositoryformatversion above 0. I don't know offhand about JGit, or any
> of the lesser-used ones like dulwich or go-git.

Today, some of these sound like shortcuts that are very likely taken quite a 
bit by cleanup and other maintenance scripts (not necessarily formal git 
tools), and the impact of these shortcuts is likely low with the current 
model. However, I suspect these tools/scripts could be seriously disruptive if 
we leave the refs dir around when using reftable,

-Martin

-- 
The Qualcomm Innovation Center, Inc. is a member of Code 
Aurora Forum, hosted by The Linux Foundation



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux