Rev 2942: clean error msg on bzr+ssh connection closing (#115601) (Ian Clatworthy) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Oct 25 11:05:12 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2942
revision-id: pqm at pqm.ubuntu.com-20071025100509-veed3zxqsmgwdug1
parent: pqm at pqm.ubuntu.com-20071025082908-abn3kunrb2ivdvth
parent: ian.clatworthy at internode.on.net-20071025092051-ehsce4bjf9wws3r4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-10-25 11:05:09 +0100
message:
  clean error msg on bzr+ssh connection closing (#115601) (Ian Clatworthy)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
  bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
    ------------------------------------------------------------
    revno: 2941.1.1
    merged: ian.clatworthy at internode.on.net-20071025092051-ehsce4bjf9wws3r4
    parent: pqm at pqm.ubuntu.com-20071025082908-abn3kunrb2ivdvth
    parent: ian.clatworthy at internode.on.net-20071025082409-c42zo7ut3mov9ihl
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: ianc-integration
    timestamp: Thu 2007-10-25 19:20:51 +1000
    message:
      clean error msg on bzr+ssh connection closing (#115601) (Ian Clatworthy)
    ------------------------------------------------------------
    revno: 2930.1.2
    merged: ian.clatworthy at internode.on.net-20071025082409-c42zo7ut3mov9ihl
    parent: ian.clatworthy at internode.on.net-20071024042621-sgatpul4anon2k2h
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: bzr.clean-disconnect
    timestamp: Thu 2007-10-25 18:24:09 +1000
    message:
      Review feedback from poolie and spiv
    ------------------------------------------------------------
    revno: 2930.1.1
    merged: ian.clatworthy at internode.on.net-20071024042621-sgatpul4anon2k2h
    parent: pqm at pqm.ubuntu.com-20071023230126-g4h0l6g1dz8e3d57
    committer: Ian Clatworthy <ian.clatworthy at internode.on.net>
    branch nick: bzr.clean-disconnect
    timestamp: Wed 2007-10-24 14:26:21 +1000
    message:
      error msg instead of assert when connection over bzr+ssh fails (#115601)
=== modified file 'NEWS'
--- a/NEWS	2007-10-25 06:17:57 +0000
+++ b/NEWS	2007-10-25 09:20:51 +0000
@@ -114,6 +114,10 @@
 
   BUG FIXES:
 
+   * Connection error reporting for the smart server has been fixed to
+     display a user friendly message instead of a traceback.
+     (Ian Clatworthy, #115601)
+
    * Make sure to use ``O_BINARY`` when opening files to check their
      sha1sum. (Alexander Belchenko, John Arbash Meinel, #153493)
 

=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2007-10-17 09:39:41 +0000
+++ b/bzrlib/errors.py	2007-10-25 09:20:51 +0000
@@ -1531,6 +1531,7 @@
 
     _fmt = "Too many redirections"
 
+
 class ConflictsInTree(BzrError):
 
     _fmt = "Working tree has conflicts."

=== modified file 'bzrlib/smart/protocol.py'
--- a/bzrlib/smart/protocol.py	2007-08-13 01:04:05 +0000
+++ b/bzrlib/smart/protocol.py	2007-10-25 08:24:09 +0000
@@ -399,8 +399,12 @@
         while not line or line[-1] != '\n':
             # TODO: this is inefficient - but tuples are short.
             new_char = self._request.read_bytes(1)
+            if new_char == '':
+                # end of file encountered reading from server
+                raise errors.ConnectionReset(
+                    "please check connectivity and permissions",
+                    "(and try -Dhpss if further diagnosis is required)")
             line += new_char
-            assert new_char != '', "end of file reading from server."
         return line
 
     def query_version(self):

=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py	2007-10-12 05:26:46 +0000
+++ b/bzrlib/tests/test_smart_transport.py	2007-10-25 08:24:09 +0000
@@ -1424,6 +1424,19 @@
         self.assertOffsetSerialisation([(1,2), (3,4), (100, 200)],
             '1,2\n3,4\n100,200', self.client_protocol)
 
+    def test_connection_closed_reporting(self):
+        input = StringIO()
+        output = StringIO()
+        client_medium = medium.SmartSimplePipesClientMedium(input, output)
+        request = client_medium.get_request()
+        smart_protocol = protocol.SmartClientRequestProtocolOne(request)
+        smart_protocol.call('hello')
+        ex = self.assertRaises(errors.ConnectionReset, 
+            smart_protocol.read_response_tuple)
+        self.assertEqual("Connection closed: "
+            "please check connectivity and permissions "
+            "(and try -Dhpss if further diagnosis is required)", str(ex))
+
     def test_accept_bytes_of_bad_request_to_protocol(self):
         out_stream = StringIO()
         smart_protocol = protocol.SmartServerRequestProtocolOne(




More information about the bazaar-commits mailing list