Multiple calls to BzrDir.open_branch() return different objects

Robert Collins robertc at robertcollins.net
Tue Feb 28 02:46:04 GMT 2006


On Mon, 2006-02-27 at 20:18 -0600, John A Meinel wrote:

> Well, we have code paths that do "branch.bzrdir.open_working_tree()",
> which also violates this. I don't remember exactly why they do, but
> doesn't that exact function cause a deadlock? (Because the created
> working tree would also create a new branch).

There is such code is legacy code which used to do branch.working_tree()
- its tree orientated code that is accepting a branch as its primary
parameter. All such cases of that should be emitting a deprecation
warning too. - and a deadlock


> A long time ago I proposed making branches singletons, and it was
> rejected because we thought that sometimes people would want to create
> to branches referencing the same location. But with the deadlocking
> issue it seems like we might want to bring up the discussion again.
> 
> I suppose it depends if we want to make the API safe, or 'correct'.
> Caching would make it 'safe', so that even poor usage would still work
> correctly (most of the time). But your version forces users to code more
> 'correctly'.

Essentially yes. It should be trivially clear when this happens though.

Martin is back wednesday/thursday, and I suspect we'll find all the
existing races when the new lock is integrated into the metadir format
shortly after that.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060228/2e2abeb8/attachment.pgp 


More information about the bazaar mailing list