Rev 2723: Tighten overbroad exceptions in patch parsing and paramiko startup in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Aug 17 14:20:06 BST 2007


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

------------------------------------------------------------
revno: 2723
revision-id: pqm at pqm.ubuntu.com-20070817132000-jr6dro4qkhf7uzwp
parent: pqm at pqm.ubuntu.com-20070817104128-30oe09d0jeoii7fx
parent: mbp at sourcefrog.net-20070817083823-nef9si8zr7r11c6l
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-08-17 14:20:00 +0100
message:
  Tighten overbroad exceptions in patch parsing and paramiko startup
modified:
  bzrlib/patches.py              patches.py-20050727183609-378c1cc5972ce908
  bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
    ------------------------------------------------------------
    revno: 2358.3.5
    merged: mbp at sourcefrog.net-20070817083823-nef9si8zr7r11c6l
    parent: mbp at sourcefrog.net-20070817083550-kyjo4eps4s2geg6h
    parent: pqm at pqm.ubuntu.com-20070816195834-vvgmajr1s1uk4m9w
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: exception-cleanups
    timestamp: Fri 2007-08-17 18:38:23 +1000
    message:
      merge trunk
    ------------------------------------------------------------
    revno: 2358.3.4
    merged: mbp at sourcefrog.net-20070817083550-kyjo4eps4s2geg6h
    parent: mbp at sourcefrog.net-20070815065807-bhq6wnzkep7drqzm
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: exception-cleanups
    timestamp: Fri 2007-08-17 18:35:50 +1000
    message:
      Fix mangled knit.py changes
    ------------------------------------------------------------
    revno: 2358.3.3
    merged: mbp at sourcefrog.net-20070815065807-bhq6wnzkep7drqzm
    parent: mbp at sourcefrog.net-20070810001150-uaqbdvu5km04a7db
    parent: pqm at pqm.ubuntu.com-20070815055603-t0fwzxv6if6sr7c6
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: exception-cleanups
    timestamp: Wed 2007-08-15 16:58:07 +1000
    message:
      merge trunk
    ------------------------------------------------------------
    revno: 2358.3.2
    merged: mbp at sourcefrog.net-20070810001150-uaqbdvu5km04a7db
    parent: mbp at sourcefrog.net-20070512190512-azo21f2tu50i46g4
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: trivial
    timestamp: Fri 2007-08-10 10:11:50 +1000
    message:
      Fix exception name
    ------------------------------------------------------------
    revno: 2358.3.1
    merged: mbp at sourcefrog.net-20070512190512-azo21f2tu50i46g4
    parent: pqm at pqm.ubuntu.com-20070314050855-7241ac88a0577101
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: interrupt
    timestamp: Sat 2007-05-12 20:05:12 +0100
    message:
      Update some too-general exception blocks
=== modified file 'bzrlib/patches.py'
--- a/bzrlib/patches.py	2007-03-03 05:47:31 +0000
+++ b/bzrlib/patches.py	2007-05-12 19:05:12 +0000
@@ -99,14 +99,14 @@
         raise MalformedHunkHeader("Does not start and end with @@.", line)
     try:
         (orig, mod) = line[3:-4].split(" ")
-    except Exception, e:
+    except (ValueError, IndexError), e:
         raise MalformedHunkHeader(str(e), line)
     if not orig.startswith('-') or not mod.startswith('+'):
         raise MalformedHunkHeader("Positions don't start with + or -.", line)
     try:
         (orig_pos, orig_range) = parse_range(orig[1:])
         (mod_pos, mod_range) = parse_range(mod[1:])
-    except Exception, e:
+    except (ValueError, IndexError), e:
         raise MalformedHunkHeader(str(e), line)
     if mod_range < 0 or orig_range < 0:
         raise MalformedHunkHeader("Hunk range is negative", line)

=== modified file 'bzrlib/transport/ssh.py'
--- a/bzrlib/transport/ssh.py	2007-03-07 13:47:47 +0000
+++ b/bzrlib/transport/ssh.py	2007-05-12 19:05:12 +0000
@@ -524,12 +524,12 @@
     global SYSTEM_HOSTKEYS, BZR_HOSTKEYS
     try:
         SYSTEM_HOSTKEYS = paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
-    except Exception, e:
+    except IOError, e:
         mutter('failed to load system host keys: ' + str(e))
     bzr_hostkey_path = pathjoin(config_dir(), 'ssh_host_keys')
     try:
         BZR_HOSTKEYS = paramiko.util.load_host_keys(bzr_hostkey_path)
-    except Exception, e:
+    except IOError, e:
         mutter('failed to load bzr host keys: ' + str(e))
         save_host_keys()
 




More information about the bazaar-commits mailing list