diff options
author | Karel Klic <kklic@redhat.com> | 2011-06-13 16:46:42 +0200 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2011-06-13 16:46:42 +0200 |
commit | 8edc80c6a08ef30d02cad35b736c0c7dcb62a7f3 (patch) | |
tree | b747ef4d0e24ad4cf2980f0681a93408011dbcd6 /src | |
parent | 6dcdb4a5cb3ed68eb7d72cc65e58055d1e4f7c65 (diff) | |
parent | 16f9e8da051b87164b77bf9a42a61ae9a97fb5fd (diff) | |
download | abrt-8edc80c6a08ef30d02cad35b736c0c7dcb62a7f3.tar.gz abrt-8edc80c6a08ef30d02cad35b736c0c7dcb62a7f3.tar.xz abrt-8edc80c6a08ef30d02cad35b736c0c7dcb62a7f3.zip |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src')
-rw-r--r-- | src/daemon/CommLayerServerDBus.c | 6 | ||||
-rw-r--r-- | src/daemon/Makefile.am | 4 | ||||
-rw-r--r-- | src/gui-gtk/abrt-gtk.c | 1 | ||||
-rw-r--r-- | src/hooks/Makefile.am | 10 | ||||
-rw-r--r-- | src/hooks/abrt-ccpp.service | 11 | ||||
-rwxr-xr-x | src/hooks/abrt-install-ccpp-hook | 97 | ||||
-rw-r--r-- | src/hooks/abrt_exception_handler.py.in | 4 | ||||
-rw-r--r-- | src/plugins/Makefile.am | 5 | ||||
-rw-r--r-- | src/plugins/abrt-oops.service | 9 | ||||
-rw-r--r-- | src/plugins/report_Bugzilla.xml.in | 4 | ||||
-rw-r--r-- | src/plugins/report_Kerneloops.xml.in | 7 | ||||
-rw-r--r-- | src/plugins/report_Mailx.xml.in | 7 | ||||
-rw-r--r-- | src/plugins/report_RHTSupport.xml.in | 7 |
13 files changed, 164 insertions, 8 deletions
diff --git a/src/daemon/CommLayerServerDBus.c b/src/daemon/CommLayerServerDBus.c index 05f7df92..28a4002d 100644 --- a/src/daemon/CommLayerServerDBus.c +++ b/src/daemon/CommLayerServerDBus.c @@ -58,6 +58,12 @@ void send_dbus_sig_Crash(const char *package_name, const char *dir, const char *uid_str ) { + /* Happens, for example, if abrt-action-save-package-data + * is not configured to run. + */ + if (!package_name) + package_name = ""; + DBusMessage* msg = new_signal_msg("Crash", NULL); if (uid_str) { diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index 58b9b2d9..0a00c254 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -1,7 +1,8 @@ eventsconfdir = $(EVENTS_CONF_DIR) dist_eventsconf_DATA = \ - smart_event.conf + smart_event.conf \ + abrt_event.conf bin_SCRIPTS = \ abrt-handle-upload @@ -88,7 +89,6 @@ dist_dbusabrtconf_DATA = dbus-abrt.conf daemonconfdir = $(CONF_DIR) dist_daemonconf_DATA = \ abrt.conf \ - abrt_event.conf \ gpg_keys comredhatabrtservicedir = ${datadir}/dbus-1/system-services diff --git a/src/gui-gtk/abrt-gtk.c b/src/gui-gtk/abrt-gtk.c index a3bf1cab..9a49787d 100644 --- a/src/gui-gtk/abrt-gtk.c +++ b/src/gui-gtk/abrt-gtk.c @@ -213,7 +213,6 @@ static void on_button_send_cb(GtkWidget *button, gpointer data) static void on_menu_report_cb(GtkMenuItem *menuitem, gpointer unused) { - s_report_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(s_report_window), _("Problem description")); gtk_window_set_default_size(GTK_WINDOW(s_report_window), 400, 400); diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am index 3fdc59ec..95cd3634 100644 --- a/src/hooks/Makefile.am +++ b/src/hooks/Makefile.am @@ -3,6 +3,9 @@ pluginsconfdir = $(PLUGINS_CONF_DIR) dist_pluginsconf_DATA = \ CCpp.conf +sbin_SCRIPTS = \ + abrt-install-ccpp-hook + libexec_PROGRAMS = abrt-hook-ccpp # abrt-hook-ccpp @@ -24,7 +27,7 @@ abrt_hook_ccpp_LDADD = \ $(LIBREPORT_LIBS) python_PYTHON = abrt.pth abrt_exception_handler.py -EXTRA_DIST = abrt_exception_handler.py.in $(man_MANS) +EXTRA_DIST = abrt_exception_handler.py.in abrt-install-ccpp-hook $(man_MANS) CLEANFILES := $(notdir $(wildcard *~)) $(notdir $(wildcard *\#)) $(notdir $(wildcard \.\#*)) $(notdir $(wildcard *.pyc)) @@ -35,3 +38,8 @@ 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,\@VAR_RUN\@,\"$(VAR_RUN)\",g abrt_exception_handler.py.in > abrt_exception_handler.py + +if HAVE_SYSTEMD +dist_systemdsystemunit_DATA = \ + abrt-ccpp.service +endif diff --git a/src/hooks/abrt-ccpp.service b/src/hooks/abrt-ccpp.service new file mode 100644 index 00000000..663322cb --- /dev/null +++ b/src/hooks/abrt-ccpp.service @@ -0,0 +1,11 @@ +[Unit] +Description=Install ABRT coredump hook + +[Service] +Type=oneshot +ExecStart=/usr/sbin/abrt-install-ccpp-hook install +ExecStop=/usr/sbin/abrt-install-ccpp-hook uninstall +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/src/hooks/abrt-install-ccpp-hook b/src/hooks/abrt-install-ccpp-hook new file mode 100755 index 00000000..12a443f0 --- /dev/null +++ b/src/hooks/abrt-install-ccpp-hook @@ -0,0 +1,97 @@ +#!/bin/bash +# Install coredump handler which saves segfault data + +# For debugging + +dry_run=false +verbose=false + +PATTERN_FILE="/proc/sys/kernel/core_pattern" +SAVED_PATTERN_DIR="/var/run/abrt" +SAVED_PATTERN_FILE="/var/run/abrt/saved_core_pattern" +HOOK_BIN="/usr/libexec/abrt-hook-ccpp" +# Must match percent_specifiers[] order in abrt-hook-ccpp.c: +PATTERN="|$HOOK_BIN /var/spool/abrt %s %c %p %u %g %t %e" +# Same, but with bogus "executable name" parameter +PATTERN1="|$HOOK_BIN /var/spool/abrt %s %c %p %u %g %t e" + +# core_pipe_limit specifies how many dump_helpers can run at the same time +# 0 - means unlimited, but it's not guaranteed that /proc/<pid> of crashing +# process will be available for dump_helper. +# 4 - means that 4 dump_helpers can run at the same time (the rest will also +# run, but they will fail to read /proc/<pid>). +# +# This should be enough for ABRT, we can miss some crashes, but what are +# the odds that more processes crash at the same time? And moreover, +# do people want to save EVERY ONE of the crashes when they have +# a crash storm? I don't think so. +# The value of 4 has been recommended by nhorman. +# +CORE_PIPE_LIMIT_FILE="/proc/sys/kernel/core_pipe_limit" +CORE_PIPE_LIMIT="4" + +start() { + cur=`cat "$PATTERN_FILE"` + cur_first=`printf "%s" "$cur" | sed 's/ .*//'` + + # Is there a %e (executable name) in old pattern anywhere? + if test x"${cur#.*%e}" = x"${cur}"; then + # No. Can use PATTERN with less risk of overflow + # on expansion (executable names can be LONG). + # Overflow would cause kernel to abort coredump. BAD. + PATTERN="$PATTERN1" + fi + + $verbose && printf "cur:'%s'\n" "$cur" + # Is it already installed? + if test x"$cur_first" != x"|$HOOK_BIN"; then # no + # It is not installed + mkdir -p -- "$SAVED_PATTERN_DIR" + printf "%s\n" "$cur" >"$SAVED_PATTERN_FILE" + # Install new handler + $verbose && printf "Installing to %s:'%s'\n" "$PATTERN_FILE" "$PATTERN" + $dry_run || echo "$PATTERN" >"$PATTERN_FILE" + + # Check core_pipe_limit and change it if it's 0, + # otherwise the abrt-hook-ccpp won't be able to read /proc/<pid> + # of the crashing process + if test x"`cat "$CORE_PIPE_LIMIT_FILE"`" = x"0"; then + echo "$CORE_PIPE_LIMIT" >"$CORE_PIPE_LIMIT_FILE" + fi + fi +} + +stop() { + if test -f "$SAVED_PATTERN_FILE"; then + $verbose && printf "Restoring to %s:'%s'\n" "$PATTERN_FILE" "`cat "$SAVED_PATTERN_FILE"`" + $dry_run || cat "$SAVED_PATTERN_FILE" >"$PATTERN_FILE" + fi +} + +status() { + cur=`cat "$PATTERN_FILE"` + cur_first=`printf "%s" "$cur" | sed 's/ .*//'` + # Is it already installed? + if test x"$cur_first" = x"|$HOOK_BIN"; then # yes + $verbose && printf "Installed\n" + return 0 + else + $verbose && printf "Not installed\n" + return 1 + fi +} + +case "$1" in +install) + start + ;; +uninstall) + stop + ;; +is-installed) + status + ;; +*) + echo $"Usage: $0 {install|uninstall|is-installed}" + return 2 +esac diff --git a/src/hooks/abrt_exception_handler.py.in b/src/hooks/abrt_exception_handler.py.in index d12968e1..5b45fcd4 100644 --- a/src/hooks/abrt_exception_handler.py.in +++ b/src/hooks/abrt_exception_handler.py.in @@ -24,7 +24,6 @@ Module for the ABRT exception handling hook import sys import os -import syslog import socket def write_dump(pid, tb): @@ -48,6 +47,7 @@ def write_dump(pid, tb): s.sendall("DONE\0") s.close() except Exception, ex: + import syslog syslog.syslog("can't communicate with ABRT daemon, is it running? %s", str(ex)) def handleMyException((etype, value, tb)): @@ -67,10 +67,10 @@ def handleMyException((etype, value, tb)): return sys.__excepthook__(etype, value, tb) try: - import os import os.path import traceback import errno + import syslog # EPIPE is not a crash, it happens all the time # Testcase: script.py | true, where script.py is: diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 040ade1f..352c23af 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -409,3 +409,8 @@ abrt_retrace_client_SOURCES = \ $(NSS_LIBS) DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ + +if HAVE_SYSTEMD +dist_systemdsystemunit_DATA = \ + abrt-oops.service +endif diff --git a/src/plugins/abrt-oops.service b/src/plugins/abrt-oops.service new file mode 100644 index 00000000..4911e2ba --- /dev/null +++ b/src/plugins/abrt-oops.service @@ -0,0 +1,9 @@ +[Unit] +Description=ABRT kernel log watcher +After=syslog.target + +[Service] +ExecStart=/usr/bin/abrt-dump-oops -d /var/spool/abrt -rwx /var/log/messages + +[Install] +WantedBy=multi-user.target diff --git a/src/plugins/report_Bugzilla.xml.in b/src/plugins/report_Bugzilla.xml.in index d12521d8..00ef4a49 100644 --- a/src/plugins/report_Bugzilla.xml.in +++ b/src/plugins/report_Bugzilla.xml.in @@ -3,8 +3,8 @@ <_name>Bugzilla</_name> <_description>Report to Bugzilla bug tracker</_description> - <requires-items></requires-items> - <exclude-items-by-default></exclude-items-by-default> + <requires-items>component,duphash,os_release</requires-items> + <exclude-items-by-default>coredump,count,event_log,reported_to</exclude-items-by-default> <exclude-items-always></exclude-items-always> <exclude-binary-items>yes</exclude-binary-items> <include-items-by-default></include-items-by-default> diff --git a/src/plugins/report_Kerneloops.xml.in b/src/plugins/report_Kerneloops.xml.in index 83ea50b5..a4da6b6b 100644 --- a/src/plugins/report_Kerneloops.xml.in +++ b/src/plugins/report_Kerneloops.xml.in @@ -2,6 +2,13 @@ <event> <_name>Kerneloops.org</_name> <_description>Send kernel problems to oops tracker</_description> + + <requires-items>backtrace</requires-items> + <exclude-items-by-default></exclude-items-by-default> + <exclude-items-always>*</exclude-items-always> + <exclude-binary-items>yes</exclude-binary-items> + <include-items-by-default></include-items-by-default> + <options> <option type="text" name="KerneloopsReporter_SubmitURL"> <_label>Kerneloops URL</_label> diff --git a/src/plugins/report_Mailx.xml.in b/src/plugins/report_Mailx.xml.in index 7584af7d..2476a3d5 100644 --- a/src/plugins/report_Mailx.xml.in +++ b/src/plugins/report_Mailx.xml.in @@ -2,6 +2,13 @@ <event> <_name>Mailx</_name> <_description>Send via email</_description> + + <requires-items></requires-items> + <exclude-items-by-default>coredump</exclude-items-by-default> + <exclude-items-always></exclude-items-always> + <exclude-binary-items>no</exclude-binary-items> + <include-items-by-default></include-items-by-default> + <options> <option type="text" name="Mailx_Subject"> <_label>Subject</_label> diff --git a/src/plugins/report_RHTSupport.xml.in b/src/plugins/report_RHTSupport.xml.in index 725be3ac..834528ae 100644 --- a/src/plugins/report_RHTSupport.xml.in +++ b/src/plugins/report_RHTSupport.xml.in @@ -2,6 +2,13 @@ <event> <_name>Red Hat Customer Support</_name> <_description>Report to Red Hat support</_description> + + <requires-items>package</requires-items> + <exclude-items-by-default>event_log,reported_to</exclude-items-by-default> + <exclude-items-always></exclude-items-always> + <exclude-binary-items>no</exclude-binary-items> + <include-items-by-default></include-items-by-default> + <options> <option type="text" name="RHTSupport_URL"> <_label>RH Portal URL</_label> |