Rev 4636: (mbp) fix crash formatting CannotBindAddress in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Aug 21 08:18:33 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4636 [merge]
revision-id: pqm at pqm.ubuntu.com-20090821071831-d3dacehbozpkpy27
parent: pqm at pqm.ubuntu.com-20090821030743-d3ydo9cq7ajbn0ew
parent: mbp at sourcefrog.net-20090821054859-9f384lsjkxuzg5pe
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-08-21 08:18:31 +0100
message:
(mbp) fix crash formatting CannotBindAddress
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/errors.py errors.py-20050309040759-20512168c4e14fbd
bzrlib/tests/test_errors.py test_errors.py-20060210110251-41aba2deddf936a8
=== modified file 'NEWS'
--- a/NEWS 2009-08-21 00:33:48 +0000
+++ b/NEWS 2009-08-21 03:17:13 +0000
@@ -34,6 +34,9 @@
* Fix a test failure on karmic by making a locale test more robust.
(Vincent Ladeuil, #413514)
+* Fix IndexError printing CannotBindAddress errors.
+ (Martin Pool, #286871)
+
Improvements
************
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py 2009-08-14 09:31:37 +0000
+++ b/bzrlib/errors.py 2009-08-21 05:48:59 +0000
@@ -2920,8 +2920,9 @@
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
def __init__(self, host, port, orig_error):
+ # nb: in python2.4 socket.error doesn't have a useful repr
BzrError.__init__(self, host=host, port=port,
- orig_error=orig_error[1])
+ orig_error=repr(orig_error.args))
class UnknownRules(BzrError):
=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py 2009-07-07 03:40:29 +0000
+++ b/bzrlib/tests/test_errors.py 2009-08-21 02:37:18 +0000
@@ -1,6 +1,4 @@
-# Copyright (C) 2006, 2007, 2008 Canonical Ltd
-# Authors: Robert Collins <robert.collins at canonical.com>
-# and others
+# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +16,9 @@
"""Tests for the formatting and construction of errors."""
+import socket
import sys
+
from bzrlib import (
bzrdir,
errors,
@@ -669,3 +669,10 @@
e = ErrorWithBadFormat(not_thing='x')
self.assertStartsWith(
str(e), 'Unprintable exception ErrorWithBadFormat')
+
+ def test_cannot_bind_address(self):
+ # see <https://bugs.edge.launchpad.net/bzr/+bug/286871>
+ e = errors.CannotBindAddress('example.com', 22,
+ socket.error(13, 'Permission denied'))
+ self.assertContainsRe(str(e),
+ r'Cannot bind address "example\.com:22":.*Permission denied')
More information about the bazaar-commits
mailing list