Rev 2177: Merge up split out hpss-chroot branch. in http://bazaar.launchpad.net/~bzr/bzr/hpss

Robert Collins robertc at robertcollins.net
Wed Mar 28 04:14:11 BST 2007


At http://bazaar.launchpad.net/~bzr/bzr/hpss

------------------------------------------------------------
revno: 2177
revision-id: robertc at robertcollins.net-20070328031239-tavfdk4e6yarr2na
parent: robertc at robertcollins.net-20070327222505-qtmqubr1zrnhjgnu
parent: robertc at robertcollins.net-20070328030232-uunyt91y60b584j9
committer: Robert Collins <robertc at robertcollins.net>
branch nick: hpss
timestamp: Wed 2007-03-28 13:12:39 +1000
message:
  Merge up split out hpss-chroot branch.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
  bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
  bzrlib/tests/test_wsgi.py      test_wsgi.py-20061005091552-rz8pva0olkxv0sd8-1
  bzrlib/transport/http/wsgi.py  wsgi.py-20061005091552-rz8pva0olkxv0sd8-2
    ------------------------------------------------------------
    revno: 2018.1.2.1.50.2.80.1.99.1.9.1.21.1.26.2.74.1.1
    merged: robertc at robertcollins.net-20070328030232-uunyt91y60b584j9
    parent: pqm at pqm.ubuntu.com-20070327081802-271be0d343108f4f
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: hpss-chroot
    timestamp: Wed 2007-03-28 13:02:32 +1000
    message:
      Rewritten chroot transport that prevents accidental chroot escapes when
      using urlutils against the transport's url.
      (Robert Collins, Andrew Bennetts)
=== modified file 'NEWS'
--- a/NEWS	2007-03-27 21:45:59 +0000
+++ b/NEWS	2007-03-28 03:12:39 +0000
@@ -5,6 +5,10 @@
     * bzrlib API compatability with 0.8 has been dropped, cleaning up some
       code paths. (Robert Collins)
 
+    * Rewritten chroot transport that prevents accidental chroot escapes when
+      using urlutils against the transport's url.
+      (Robert Collins, Andrew Bennetts)
+
     * ``LockableFiles.lock_write()`` now accepts a ``token`` keyword argument,
       so that a seperate LockableFiles instance can share a lock if it has the
       right token.  (Andrew Bennetts, Robert Collins)

=== modified file 'bzrlib/tests/test_transport.py'
--- a/bzrlib/tests/test_transport.py	2007-03-27 09:46:24 +0000
+++ b/bzrlib/tests/test_transport.py	2007-03-28 03:12:39 +0000
@@ -22,16 +22,15 @@
 
 import bzrlib
 from bzrlib import urlutils
-from bzrlib.errors import (
-    ConnectionError,
-    DependencyNotPresent,
-    FileExists,
-    InvalidURLJoin,
-    NoSuchFile,
-    PathNotChild,
-    TransportNotPossible,
-    UnsupportedProtocol,
-    )
+from bzrlib.errors import (ConnectionError,
+                           DependencyNotPresent,
+                           FileExists,
+                           InvalidURLJoin,
+                           NoSuchFile,
+                           PathNotChild,
+                           TransportNotPossible,
+                           UnsupportedProtocol,
+                           )
 from bzrlib.tests import TestCase, TestCaseInTempDir
 from bzrlib.transport import (_CoalescedOffset,
                               _get_protocol_handlers,
@@ -72,7 +71,7 @@
             _set_protocol_handlers(my_handlers)
             register_lazy_transport('foo', 'bzrlib.tests.test_transport', 'TestTransport.SampleHandler')
             register_lazy_transport('bar', 'bzrlib.tests.test_transport', 'TestTransport.SampleHandler')
-            self.assertEqual([SampleHandler.__module__],
+            self.assertEqual([SampleHandler.__module__, 'bzrlib.transport.chroot'],
                              _get_transport_modules())
         finally:
             _set_protocol_handlers(handlers)
@@ -379,21 +378,6 @@
         server.tearDown()
 
 
-class FakeTransport(object):
-    # XXX: FakeTransport copied from test_wsgi.py
-
-    def __init__(self):
-        self.calls = []
-        self.base = 'fake:///'
-
-    def abspath(self, relpath):
-        return 'fake:///' + relpath
-
-    def clone(self, relpath):
-        self.calls.append(('clone', relpath))
-        return self
-
-
 class ReadonlyDecoratorTransportTest(TestCase):
     """Readonly decoration specific tests."""
 

=== modified file 'bzrlib/tests/test_transport_implementations.py'
--- a/bzrlib/tests/test_transport_implementations.py	2007-03-27 09:46:24 +0000
+++ b/bzrlib/tests/test_transport_implementations.py	2007-03-28 03:12:39 +0000
@@ -38,7 +38,7 @@
 from bzrlib.symbol_versioning import zero_eleven
 from bzrlib.tests import TestCaseInTempDir, TestSkipped
 from bzrlib.tests.test_transport import TestTransportImplementation
-from bzrlib.transport import memory, chroot
+from bzrlib.transport import memory
 from bzrlib.smart import medium
 import bzrlib.transport
 

=== modified file 'bzrlib/tests/test_wsgi.py'
--- a/bzrlib/tests/test_wsgi.py	2007-03-27 09:46:24 +0000
+++ b/bzrlib/tests/test_wsgi.py	2007-03-28 03:12:39 +0000
@@ -85,8 +85,8 @@
     def test_smart_wsgi_app_uses_given_relpath(self):
         # XXX XXX XXX update comment
         # The SmartWSGIApp should use the "bzrlib.relpath" field from the
-        # WSGI environ to construct the transport for this request, by cloning
-        # its base transport with the given relpath.
+        # WSGI environ to clone from its backing transport to get a specific
+        # transport for this request.
         transport = FakeTransport()
         wsgi_app = wsgi.SmartWSGIApp(transport)
         wsgi_app.backing_transport = transport

=== modified file 'bzrlib/transport/http/wsgi.py'
--- a/bzrlib/transport/http/wsgi.py	2007-03-27 09:46:24 +0000
+++ b/bzrlib/transport/http/wsgi.py	2007-03-28 03:12:39 +0000
@@ -98,12 +98,13 @@
         self.chroot_server = chroot.ChrootServer(backing_transport)
         self.chroot_server.setUp()
         self.backing_transport = get_transport(self.chroot_server.get_url())
-        # XXX: explain why not:
+        # While the chroot server can technically be torn down at this point,
+        # as all it does is remove the scheme registration from transport's 
+        # protocol dictionary, we dont *just in case* there are parts of 
+        # bzrlib that will invoke 'get_transport' on urls rather than cloning
+        # around the existing transport.
         #self.chroot_server.tearDown()
 
-        #self.backing_transport = chroot.ChrootTransportDecorator(
-        #    'chroot+' + backing_transport.base, _decorated=backing_transport)
-
     def __call__(self, environ, start_response):
         """WSGI application callable."""
         if environ['REQUEST_METHOD'] != 'POST':



More information about the bazaar-commits mailing list