[MERGE] [BUG 363837] catch rmtree failure in diff and mutter to logfile

Maritza Mendez martitzam at gmail.com
Tue May 12 08:42:40 BST 2009


On Tue, May 12, 2009 at 12:25 AM, Alexander Belchenko <bialix at ukr.net>wrote:

> BB:resubmit
>
> General rule for bzr (and most python program IMO) is: don't use bare
> except, because it has undesirable effect of catching ALL errors.
> We know what error we want to ignore (OSError) so we should explicitly use
> it in except.
>
> --- bzrlib/diff.py      2009-03-28 02:10:54 +0000
> +++ bzrlib/diff.py      2009-05-12 05:31:39 +0000
> @@ -731,7 +731,10 @@
>         return old_disk_path, new_disk_path
>
>     def finish(self):
> -        osutils.rmtree(self._root)
> +        try:
> +            osutils.rmtree(self._root)
> +        except:
> +            mutter("The temporary directory \"%s\" was not cleanly
> removed." % self._root)
>
> ^-- You should use here "except OSerror:"
>
> Also you need to mention the bug you fixing in the NEWS (in the
> corresponding section).
>
> Resubmit your patch, please.


Thanks.  That was my plan (OSError).  And I actually did read about updating
news in the contributor's guide but spaced out.  Thanks catching those.  I
had a bzr shelve go bad and then bzr check returned an key error.  It's been
a tough couple of hours.  I will resubmit when I'm actually awake.

-M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20090512/cb8dc9ea/attachment-0001.htm 


More information about the bazaar mailing list