BzrDir.find_branches() goes into an infinite loop on MemoryTransport

Bug #188855 reported by James Henstridge
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Medium
James Henstridge

Bug Description

If I run BzrDir.find_branches() on a MemoryTransport that contains directories, I see an infinite loop.

A simple test program that triggers the bug is:

    from bzrlib.bzrdir import BzrDir
    from bzrlib.transport import get_transport
    from bzrlib.transport.memory import MemoryServer

    server = MemoryServer()
    server.setUp()
    transport = get_transport(server.get_url())
    BzrDir.create_branch_and_repo(transport.abspath('.'))
    for branch in BzrDir.find_branches(transport):
        print branch.base

Adding a few debug prints shows that MemoryTransport.list_dir() is always returning the directories at the base of the tree, irrespective of the transport's base URL.

So in the above example, it effectively does:
 1. checks to see if memory+NNN:/// is a branch (it is).
 2. lists memory+NNN:///, getting ['.bzr'] as a result.
 3. checks to see if memory+NNN:///.bzr/ is a branch (it is not)
 4. lists memory+NNN:///.bzr/, getting ['.bzr'] as a result.
 5. checks to see if memory+NNN:///.bzr/.bzr/ is a branch (it isn't -- the path does not exist)
 6. lists memory+NNN://.bzr/.bzr/, getting ['.bzr'] as a result, despite the fact that the directory doesn't exist
 ...

This makes it impossible to use TestCaseWithMemoryTransport for tests that involve BzrDir.find_branches() or BzrDir.find_bzrdirs().

Revision history for this message
James Henstridge (jamesh) wrote :
Changed in bzr:
assignee: nobody → jamesh
importance: Undecided → Medium
milestone: none → 1.3
status: New → Fix Committed
Changed in bzr:
status: Fix Committed → Fix Released
Changed in bzr:
milestone: 0.9a → 1.3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.