bug: ctrl-c during revision installation may be ignored

Andrew Bennetts andrew at canonical.com
Mon Sep 12 15:50:34 BST 2005

On Mon, Sep 12, 2005 at 10:26:27PM +1000, Martin Pool wrote:
> On 12/09/05, Robert Collins <robertc at robertcollins.net> wrote:
> > Something in bzr has an overly broad except clause - I did a ctrl-c
> > during the revision pulling phase of a merge, which resulted in a
> > 'failed to install revisionX' message, but the revision pulling
> > continuing.
> > 
> > As a general principal, we should never have a catch-all except clause
> > except where we also have either a raise (in this case a finally:
> > probably makes more sense), or a very very tightly constrained context.
> I don't *think* we have any catchall except clauses; if we do they
> should be fixed.  I have noticed that some of the C code for gzip and
> similar stuff seems to swallow exceptions.

I did a quick grep, and then manually looked over the results.  The
following will swallow KeyboardInterrupt (and MemoryError...):

bzrlib/plugin.py:121:            except:
bzrlib/selftest/test_merge_core.py:256:            except:
bzrlib/util/urlgrabber/grabber.py:827:            except: length = None
bzrlib/util/urlgrabber/grabber.py:1007:            except: pass
bzrlib/util/effbot/org/http_manager.py:51:                except:
bzrlib/util/effbot/org/http_manager.py:59:                except:
bzrlib/remotebranch.py:187:        except:
bzrlib/builtins.py:1047:        except:

The plugin.py one at least logs the error, but that's not the behaviour you

The test one is less crucial, but it's still annoying to have Ctrl-C not
work reliably when running tests.

The others appear to genuinely swallow KeyboardInterrupts in one way or


More information about the bazaar mailing list