[MERGE][0.90][Bug 133965] PathNotChild, port mismatch with "bzr info" for bzr:// smartserver

James Westby jw+debian at jameswestby.net
Thu Aug 23 21:39:42 BST 2007


Hi,

Attached is a bundle for the 0.90 branch that attempts to fix this
issue.

The commit message hopefully explains the issue and the fix quite well,
but I am not sure it is the correct one, specifically is it now being
too lenient, in that it will allow two URIs to match that refer to
different ports?

There is also another case that seems like it may also cause issues,
namely _reuse_for in bzrlib/transport/__init__.py, as that compares
self._port to the output of _split_url. If someone that understands the
transport framework better than me could evaluate whether this could
cause bugs that would be great.

The reason the tests didn't get this bug in the first place is that the
implementation tests use urls with a specific, non-default port, which
doesn't trigger the issue, and the general tests didn't use bzr://.

Thanks,

James

-- 
  James Westby   --    GPG Key ID: B577FE13    --     http://jameswestby.net/
  seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256
-------------- next part --------------
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: jw+debian at jameswestby.net-20070823191230-\
#   b62gwlx3souge25q
# target_branch: http://bazaar-vcs.org/bzr/bzr.0.90/
# testament_sha1: efb96fa837eea942baa224351ca4323d9481bad3
# timestamp: 2007-08-23 20:12:44 +0100
# base_revision_id: pqm at pqm.ubuntu.com-20070822004557-ipcsdwnro02sbrpd
# 
# Begin patch
=== modified file 'NEWS'
--- NEWS	2007-08-21 20:54:11 +0000
+++ NEWS	2007-08-23 19:12:30 +0000
@@ -18,6 +18,11 @@
       from the developer document catalog back to the main one.
       (Ian Clatworthy, Sabin Iacob, Alexander Belchenko)
 
+  BUGFIXES:
+
+    * Make the bzr:// transport work again for some operations (e.g. info)
+      when using the default port. (James Westby, #133965)
+
 
 bzr 0.90rc1 2007-08-14
 ======================

=== modified file 'bzrlib/tests/test_transport.py'
--- bzrlib/tests/test_transport.py	2007-07-22 15:44:59 +0000
+++ bzrlib/tests/test_transport.py	2007-08-23 19:12:30 +0000
@@ -54,6 +54,7 @@
 from bzrlib.transport.memory import MemoryTransport
 from bzrlib.transport.local import (LocalTransport,
                                     EmulatedWin32LocalTransport)
+from bzrlib.transport.remote import RemoteTCPTransport
 
 
 # TODO: Should possibly split transport-specific tests into their own files.
@@ -665,6 +666,17 @@
         t = ConnectedTransport('sftp://host.com/dev/%path')
         self.assertEquals(t.relpath('sftp://host.com/dev/%path/sub'), 'sub')
 
+    def test_relpath_when_transport_uses_a_port(self):
+        """If no port is specified then it is the same as the default.
+
+        When the transport uses a port then relpath assumes that
+        the request must have the same port, otherwise it is not a child.
+        However if the request has no port then the default port is
+        used, and this will match what the server is listening on.
+        """
+        t = RemoteTCPTransport('bzr://host.com/')
+        self.assertEquals(t.relpath('bzr://host.com/'), '')
+
     def test_connection_sharing_propagate_credentials(self):
         t = ConnectedTransport('foo://user@host.com/abs/path')
         self.assertIs(None, t._get_connection())

=== modified file 'bzrlib/transport/__init__.py'
--- bzrlib/transport/__init__.py	2007-08-09 03:23:04 +0000
+++ bzrlib/transport/__init__.py	2007-08-23 19:12:30 +0000
@@ -1267,7 +1267,7 @@
             error.append('user name mismatch')
         if (host != self._host):
             error.append('host mismatch')
-        if (port != self._port):
+        if (port is not None and port != self._port):
             error.append('port mismatch')
         if not (path == self._path[:-1] or path.startswith(self._path)):
             error.append('path mismatch')

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWZFLJ84AA3JfgFQQef///1v3
XsC////wYAfzujcM+OVRbmru5wtu5x1pkmoSSCRqeUzCmTanlNMU/RE/UpsKMD1CGJ6no02oEpNA
JiCnlMRNNHpPUD1AaADQANACKehI0MhkNDTI0NNANAABpiDEaYSIhGiaEymmU0eJ5NU9TanqA0AM
jTIGhoOGmmRiMJpgIYBNMIwTEyGmRoaASRE0AJk0aTSZiap5qnqPUNNM00n6ptQABtRwJQ5MjYw0
5Gdd9FOlV+svudHunHktarHOdnbprC9IgxFZzU5rtr4H9YgE47rq6U3Rk2EnSv1Xc8V/DgT4sASi
FTlsfPlfo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