[BUG] cannot bind one branch in a repository to another

Martin Pool mbp at sourcefrog.net
Tue May 9 09:34:42 BST 2006


On  8 May 2006, John A Meinel <john at arbash-meinel.com> wrote:
> When I look, there is a pending.... directory left in the lock
> directory. As best I can figure it, the above 'bind' is attempting to
> lock other's repository, which is already locked, because it is the same
> as self's repository.
> 
> I think this is an issue because we are issuing 2 lock_write() calls on
> both branches. Most of the time we only lock one branch for writing (the
> other branch for reading).

Yes.

> I'm not sure what the best solution is. But it brings us back to the
> issue of wanting to lock the same location twice, because we arrive at
> it from different code paths.

We need both callers to realize that they're talking about the same
repository, and so lock it only once.

This has to be done above the level of the lock: we should have only one
Repository object representing the single real object.  That has to be
done, I suppose, by seeing that their canonical physical paths are the
same.  This is a bit unsatisfactory; in particular something like 'bzr
branch sftp://localhost/~/repo/a ~/repo/b' is tricky, though perhaps
that's a corner case.

There should be enough information in the lock-held info that we can see
it is in fact our own process that has it locked.  Possibly we can use
that to realize that we already have an object representing it, and so
match that up.  This has the advantage that it should work even if we're
reaching the two things in a way that we couldn't realize they're
identical.  (This will take some thought about security; we don't want
someone causing mischief by copying our lock info from one place to
another.)

-- 
Martin




More information about the bazaar mailing list