summaryrefslogtreecommitdiffstats
path: root/src/Hooks
diff options
context:
space:
mode:
authorkarel <karel@localhost.localdomain>2010-05-14 17:13:53 +0200
committerKarel Klic <kklic@redhat.com>2010-06-09 17:18:47 +0200
commit50b676e4e3ffda79665712d4522887fdb2f2ba06 (patch)
treeb59220a7443dd73e8726de57028efe7ebc59de4f /src/Hooks
parenta28c9745990dbbf1454b449d454142f5603fa25e (diff)
Daemon socket for reporting crashes
Diffstat (limited to 'src/Hooks')
-rw-r--r--src/Hooks/Makefile.am5
-rw-r--r--src/Hooks/abrt_exception_handler.py.in25
2 files changed, 19 insertions, 11 deletions
diff --git a/src/Hooks/Makefile.am b/src/Hooks/Makefile.am
index ef4ab821..3c8aeb94 100644
--- a/src/Hooks/Makefile.am
+++ b/src/Hooks/Makefile.am
@@ -47,9 +47,10 @@ EXTRA_DIST = abrt_exception_handler.py.in $(man_MANS)
CLEANFILES := $(notdir $(wildcard *~)) $(notdir $(wildcard *\#)) $(notdir $(wildcard \.\#*)) $(notdir $(wildcard *.pyc))
+# Must be synchronized with another sed call below.
abrt_exception_handler.py:
- sed s,@DEBUG_DUMP_DIR@,$(DEBUG_DUMPS_DIR),g abrt_exception_handler.py.in > abrt_exception_handler.py
+ sed s,\@VAR_RUN\@,\"$(VAR_RUN)\",g abrt_exception_handler.py.in > abrt_exception_handler.py
# RPM fix: we need to regenerate abrt_exception_handler.py, because it has the default ddir
install-data-local:
- sed s,@DEBUG_DUMP_DIR@,$(DEBUG_DUMPS_DIR),g abrt_exception_handler.py.in > abrt_exception_handler.py
+ sed s,\@VAR_RUN\@,\"$(VAR_RUN)\",g abrt_exception_handler.py.in > abrt_exception_handler.py
diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in
index a4bc93d5..99817296 100644
--- a/src/Hooks/abrt_exception_handler.py.in
+++ b/src/Hooks/abrt_exception_handler.py.in
@@ -19,27 +19,34 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
"""
-Module for a userfriendly exception handling
+Module for the ABRT exception handling hook
"""
import sys
import os
import syslog
import subprocess
+import socket
def write_dump(pid, tb):
executable = "Exception raised from python shell"
if sys.argv[0]:
executable = os.path.abspath(sys.argv[0])
- command = ["/usr/libexec/abrt-hook-python"]
- command.append("--pid=%s" % pid)
- command.append("--executable=%s" % executable)
-
- helper = subprocess.Popen(command, stdin=subprocess.PIPE)
- helper.communicate(tb)
- helper.wait()
-
+ # Open ABRT daemon's socket and write data to it.
+ s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+ s.connect(@VAR_RUN@ + "/abrt.socket")
+ s.sendall("PID=%s\0" % pid)
+ s.sendall("EXECUTABLE=%s\0" % executable)
+ s.sendall("ANALYZER=Python\0")
+ s.sendall("BASENAME=pyhook\0")
+ # This handler puts a short(er) crash descr in 1st line of the backtrace.
+ # Example:
+ # CCMainWindow.py:1:<module>:ZeroDivisionError: integer division or modulo by zero
+ s.sendall("REASON=%s\0" % tb.splitlines()[0])
+ s.sendall("BACKTRACE=%s\0" % tb)
+ s.sendall("DONE\0")
+ s.close()
def handleMyException((etype, value, tb)):
"""