On 05/12/2010 08:11 PM, Denys Vlasenko wrote:
diff -x '*.po' -d -urpN
abrt.8/src/Hooks/abrt_exception_handler.py.in
abrt.9/src/Hooks/abrt_exception_handler.py.in
--- abrt.8/src/Hooks/abrt_exception_handler.py.in 2010-03-29 17:56:48.000000000
+0200
+++ abrt.9/src/Hooks/abrt_exception_handler.py.in 2010-05-12 20:06:04.833275892
+0200
@@ -30,9 +30,6 @@ import subprocess
def write_dump(pid, tb):
executable = "Exception raised from python shell"
if sys.argv[0]:
- # FIXME: is this reliable?!
- # what if argv[0] is relative and we chdir'ed somewhere
- # during execution?
executable = os.path.abspath(sys.argv[0])
command = ["/usr/libexec/abrt-hook-python"]
@@ -79,10 +76,15 @@ def handleMyException((etype, value, tb)
# "-c" appears in this case:
# $ python -c 'import sys; print "argv0 is:%s" %
sys.argv[0]'
# argv0 is:-c
- if sys.argv[0] and sys.argv[0] != "-c":
- syslog.syslog("abrt: detected unhandled Python exception in %s" %
sys.argv[0])
- else: # interactive Python etc
+ if not sys.argv[0] or sys.argv[0] == "-c":
+ # Looks like interactive Python - abort dumping
syslog.syslog("abrt: detected unhandled Python exception")
+ throw
- there is no "throw" in python, you probably want
something like
raise Exception("Looks like interactive Python - abort dumping")
+ syslog.syslog("abrt: detected unhandled Python
exception in %s" % sys.argv[0])
+ if sys.argv[0][0] != "/":
+ # Relative path - can't reliably determine package
+ # this script belongs to - abort dumping
+ throw
- .. and the same here
the rest seems ok.
Reviewed by: jmoskovc(a)redhat.com