[Piuparts-commits] [piuparts] 50/51: p: run panic handlers if piuparts dies on an exception

Holger Levsen holger at layer-acht.org
Thu Jul 20 21:15:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit 5cef931c1b8263af9e964c5352b04cf10bfac1dc
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Jul 11 12:47:39 2017 +0200

    p: run panic handlers if piuparts dies on an exception
    
    catch all unhandled exceptions (e.g. SyntaxError), except for
    SystemExit (from panic()), and run panic handlers (otherwise the
    tmpdir gets quickly filled up)
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog                     |  1 +
 master-bin/detect_piuparts_issues.in |  3 ++-
 piuparts.py                          | 11 +++++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 3301b0c..f3bc232 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,7 @@ piuparts (0.78) UNRELEASED; urgency=medium
     - New option --upgrade-before-dist-upgrade for 2-stage upgrades:
       'apt-get upgrade && apt-get dist-upgrade'.
     - Do not ignore errors while removing packages.
+    - Run panic handlers before aborting due to an unhandled exception.
   * piuparts.conf:
     - Use more aliases for mapping between releases and codenames to reduce
       the amount of changes needed on "moving targets" (like stable22sid)
diff --git a/master-bin/detect_piuparts_issues.in b/master-bin/detect_piuparts_issues.in
index 14fc359..eee1c83 100755
--- a/master-bin/detect_piuparts_issues.in
+++ b/master-bin/detect_piuparts_issues.in
@@ -76,8 +76,9 @@ add_pattern 'Firebird .* server already running.'
 # scripts etc. would be indented by 2 spaces, so don't match here.
 add_pattern "^RuntimeError: maximum recursion depth exceeded while calling a Python object"
 add_pattern "^Traceback"
-add_pattern "^OSError:"
 add_pattern "^IndentationError:"
+add_pattern "^NameError:"
+add_pattern "^OSError:"
 add_pattern "^SyntaxError:"
 
 FILE=`mktemp`
diff --git a/piuparts.py b/piuparts.py
index c0fd1ab..3769ec9 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -50,6 +50,7 @@ import stat
 import re
 import pickle
 import subprocess
+import traceback
 import urllib
 import uuid
 import apt_pkg
@@ -3425,5 +3426,15 @@ if __name__ == "__main__":
         print 'Piuparts interrupted by the user, exiting...'
         panic(1)
         sys.exit(1)
+    except SystemExit:
+        raise
+    except:
+        print ''
+        print 'Piuparts caught exception, exiting...'
+        print '-'*60
+        traceback.print_exc(file=sys.stdout)
+        print '-'*60
+        panic(1)
+        raise
 
 # vi:set et ts=4 sw=4 :

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list