diff options
| author | Nikola Pajkovsky <npajkovs@redhat.com> | 2009-10-26 10:33:37 +0100 |
|---|---|---|
| committer | Nikola Pajkovsky <npajkovs@redhat.com> | 2009-10-26 10:33:37 +0100 |
| commit | 9fd559b06bbf3f9a40eca5e0663392801d2677b7 (patch) | |
| tree | dbd83423492437fd9c0cebe5b7e389031dbae40e /src | |
| parent | b8133aeef0d0bd80ebd3d62deb6651f4925bd911 (diff) | |
| parent | cd8efd80bde252be614b5849653bdacc8a7d1f02 (diff) | |
| download | abrt-9fd559b06bbf3f9a40eca5e0663392801d2677b7.tar.gz abrt-9fd559b06bbf3f9a40eca5e0663392801d2677b7.tar.xz abrt-9fd559b06bbf3f9a40eca5e0663392801d2677b7.zip | |
Merge branch 'master' into experimental
Diffstat (limited to 'src')
| -rw-r--r-- | src/CLI/Makefile.am | 2 | ||||
| -rwxr-xr-x | src/Daemon/abrt-debuginfo-install | 109 | ||||
| -rw-r--r-- | src/Gui/ABRTExceptions.py | 8 | ||||
| -rw-r--r-- | src/Gui/ABRTPlugin.py | 27 | ||||
| -rw-r--r-- | src/Gui/CCMainWindow.py | 10 | ||||
| -rw-r--r-- | src/Gui/CellRenderers.py | 5 | ||||
| -rw-r--r-- | src/Gui/ConfBackend.py | 21 | ||||
| -rw-r--r-- | src/Gui/SettingsDialog.py | 12 | ||||
| -rw-r--r-- | src/Hooks/Makefile.am | 18 | ||||
| -rw-r--r-- | src/Hooks/abrt-pyhook-helper.cpp | 138 | ||||
| -rw-r--r-- | src/Hooks/abrt_exception_handler.py.in | 53 | ||||
| -rw-r--r-- | src/Hooks/sitecustomize.py | 12 |
12 files changed, 285 insertions, 130 deletions
diff --git a/src/CLI/Makefile.am b/src/CLI/Makefile.am index 7b10bfb..dbeb1c3 100644 --- a/src/CLI/Makefile.am +++ b/src/CLI/Makefile.am @@ -27,6 +27,6 @@ man_MANS = abrt-cli.1 EXTRA_DIST = $(man_MANS) completiondir = $(sysconfdir)/bash_completion.d -completion_DATA = abrt-cli.bash +dist_completion_DATA = abrt-cli.bash DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ diff --git a/src/Daemon/abrt-debuginfo-install b/src/Daemon/abrt-debuginfo-install index fc5380b..1f947cd 100755 --- a/src/Daemon/abrt-debuginfo-install +++ b/src/Daemon/abrt-debuginfo-install @@ -62,10 +62,6 @@ tempdir=$2 cachedir=$3 debug=false -count_words() { - echo $# -} - exec 2>&1 test -f "$core" || exit 2 @@ -78,6 +74,37 @@ mkdir "$tempdir" || exit 2 cd "$tempdir" || exit 2 $debug && echo "Installing rpms to $tempdir" + +count_words() { + echo $# +} + +cleanup_and_report_missing() { +# Which debuginfo files are still missing, including those we just unpacked? + missing_build_ids=`for build_id in $build_ids; do + build_id1=${build_id:0:2} + build_id2=${build_id:2} + file="usr/lib/debug/.build-id/$build_id1/$build_id2.debug" + test -f "/$file" && continue + test -f "$cachedir/$file" && continue + echo -n "$build_id " + done` + $debug && echo "missing_build_ids:$missing_build_ids" + + # If cachedir is specified, tempdir is just a staging area. Delete it + if test x"$cachedir" != x""; then + $debug && echo "Removing $tempdir" + rm -rf "$tempdir" + fi + + for missing in $missing_build_ids; do + echo "MISSING:$missing" + done + + test x"$missing_build_ids" != x"" && echo "`count_words $missing_build_ids` debuginfos can't be found" +} + + # eu-unstrip output example: # 0x400000+0x209000 23c77451cf6adff77fc1f5ee2a01d75de6511dda@0x40024c - - [exe] # or @@ -86,7 +113,9 @@ $debug && echo "Installing rpms to $tempdir" # 0x3d15600000+0x208000 20196628d1bc062279622615cc9955554e5bb227@0x3d156001a0 /usr/lib64/libnotify.so.1.1.3 /usr/lib/debug/usr/lib64/libnotify.so.1.1.3.debug libnotify.so.1 # 0x7fd8ae931000+0x62d000 dd49f44f958b5a11a1635523b2f09cb2e45c1734@0x7fd8ae9311a0 /usr/lib64/libgtk-x11-2.0.so.0.1600.6 /usr/lib/debug/usr/lib64/libgtk-x11-2.0.so.0.1600.6.debug echo "Getting list of build IDs" -eu_unstrip_OUT=`eu-unstrip "--core=$core" -n 2>&1` +# Observed errors: +# eu-unstrip: /var/cache/abrt/ccpp-1256301004-2754/coredump: Callback returned failure +eu_unstrip_OUT=`eu-unstrip "--core=$core" -n 2>eu_unstrip.ERR` err=$? printf "%s\nexitcode:%s\n" "$eu_unstrip_OUT" $err >eu_unstrip.OUT test $err = 0 || exit 2 @@ -112,24 +141,19 @@ $debug && echo "build_ids:$build_ids" missing_debuginfo_files=`for build_id in $build_ids; do build_id1=${build_id:0:2} build_id2=${build_id:2} - file="usr/lib/debug/.build-id/$build_id1/$build_id2.debug" if test x"$cachedir" != x"" && test x"$cachedir" != x"/" ; then test -f "$cachedir/$file" && continue - if test -f "/$file"; then - mkdir -p "$cachedir/usr/lib/debug/.build-id/$build_id1" - # Note: this does not preserve symlinks. This is intentional - $debug && echo Copying "$file" to "$cachedir/$file" >&2 - cp "$file" "$cachedir/$file" - continue - fi fi test -f "/$file" && continue echo -n "/$file " done` $debug && echo "missing_debuginfo_files:$missing_debuginfo_files" -test x"$missing_debuginfo_files" = x"" && exit 0 +if test x"$missing_debuginfo_files" = x""; then + cleanup_and_report_missing + exit 0 +fi # We'll run something like: # yum --enablerepo='*debuginfo*' --quiet provides \ @@ -162,7 +186,10 @@ $debug && echo "packages:$packages" # yum may return "" here if it found no packages (say, if coredump is from a new, # unreleased package fresh from koji). -test x"$packages" = x"" && exit 1 +if test x"$packages" = x""; then + cleanup_and_report_missing + exit 1 +fi # Redirecting, since progress bar stuff only messes up our output echo "Downloading `count_words $packages` packages" @@ -180,45 +207,31 @@ for f in *.rpm; do rpm2cpio <"$f" 2>>unpack.OUT | cpio -id >>unpack.OUT 2>&1 done -# Which debuginfo files are still missing, including those we just unpacked? -missing_build_ids=`for build_id in $build_ids; do - build_id1=${build_id:0:2} - build_id2=${build_id:2} +# Copy debuginfo files to cachedir +if test x"$cachedir" != x"" && test -d "$cachedir"; then + for build_id in $build_ids; do + build_id1=${build_id:0:2} + build_id2=${build_id:2} - file="usr/lib/debug/.build-id/$build_id1/$build_id2.debug" + file="usr/lib/debug/.build-id/$build_id1/$build_id2.debug" - test -f "/$file" && continue - test x"$cachedir" != x"" \ - && test x"$cachedir" != x"/" \ - && test -f "$cachedir/$file" && continue - - if test -f "$file"; then - # file is one of those we just installed. - # Cache it if cachedir is specified. - if test x"$cachedir" != x"" && test -d "$cachedir"; then + test -f "/$file" && continue + test x"$cachedir" != x"/" && test -f "$cachedir/$file" && continue + + if test -f "$file"; then + # file is one of those we just installed. + # Cache it if cachedir is specified. mkdir -p "$cachedir/usr/lib/debug/.build-id/$build_id1" # Note: this does not preserve symlinks. This is intentional - $debug && echo Copying "$file" to "$cachedir/$file" >&2 + $debug && echo Copying2 "$file" to "$cachedir/$file" >&2 cp --remove-destination "$file" "$cachedir/$file" + continue fi - continue - fi - echo -n "$build_id " -done` -$debug && echo "missing_build_ids:$missing_build_ids" - -# If cachedir is specified, tempdir is just a staging area. Delete it -if test x"$cachedir" != x""; then - $debug && echo "Removing $tempdir" - rm -rf "$tempdir" + done fi +$debug && echo "missing_build_ids:$missing_build_ids" -test x"$missing_build_ids" = x"" && exit 0 - -for missing in $missing_build_ids; do - echo "MISSING:$missing" -done - -echo "`count_words $missing_build_ids` debuginfos can't be found" +cleanup_and_report_missing -exit 1 +test x"$missing_build_ids" != x"" && exit 1 +exit 0 diff --git a/src/Gui/ABRTExceptions.py b/src/Gui/ABRTExceptions.py index 0d357a3..c4d6b59 100644 --- a/src/Gui/ABRTExceptions.py +++ b/src/Gui/ABRTExceptions.py @@ -14,11 +14,3 @@ class WrongData(Exception): def __str__(self): return self.what - -class ConfBackendInitError(Exception): - def __init__(self, msg): - Exception.__init__(self) - self.what = msg - - def __str__(self): - return self.what diff --git a/src/Gui/ABRTPlugin.py b/src/Gui/ABRTPlugin.py index 8d687f8..8483be4 100644 --- a/src/Gui/ABRTPlugin.py +++ b/src/Gui/ABRTPlugin.py @@ -11,12 +11,17 @@ Email Description """ from abrt_utils import _ -from ConfBackend import ConfBackendGnomeKeyring +from ConfBackend import ConfBackendGnomeKeyring, ConfBackendInitError class PluginSettings(dict): def __init__(self): dict.__init__(self) - self.conf = ConfBackendGnomeKeyring() + self.conf = None + try: + self.conf = ConfBackendGnomeKeyring() + except ConfBackendInitError, e: + print e + pass def check(self): for key in ["Password", "Login"]: @@ -32,16 +37,18 @@ class PluginSettings(dict): for key in default_settings.keys(): self[str(key)] = str(default_settings[key]) - settings = self.conf.load(name) - # overwrite defaluts with user setting - for key in settings.keys(): - # only rewrite keys needed by the plugin - # e.g we don't want a pass field for logger - if key in default_settings.keys(): - self[str(key)] = str(settings[key]) + if self.conf: + settings = self.conf.load(name) + # overwrite defaluts with user setting + for key in settings.keys(): + # only rewrite keys needed by the plugin + # e.g we don't want a pass field for logger + if key in default_settings.keys(): + self[str(key)] = str(settings[key]) def save(self, name): - self.conf.save(name, self) + if self.conf: + self.conf.save(name, self) class PluginInfo(): """Class to represent common plugin info""" diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index eee6884..34c2def 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -154,9 +154,12 @@ class MainWindow(): def on_miSettings_clicked(self, widget): dialog = SettingsDialog(self.window, self.ccdaemon) - dialog.hydrate() + try: + dialog.hydrate() + except Exception, e: + gui_error_message(_("Can't show the settings dialog\n%s" % e)) + return dialog.show() - self.ccdaemon.getSettings() def warning_cb(self, daemon, message=None): # try to hide the progressbar, we dont really care if it was visible .. @@ -210,7 +213,8 @@ class MainWindow(): entry.getTime("%c"), entry.getCount(), entry.isReported(), entry]) # activate the last row if any.. if n: - self.dlist.set_cursor(self.dumpsListStore.get_path(n)) + # we can use (0,) as path for the first row, but what if API changes? + self.dlist.set_cursor(self.dumpsListStore.get_path(self.dumpsListStore.get_iter_first())) def filter_dumps(self, model, miter, data): # for later.. diff --git a/src/Gui/CellRenderers.py b/src/Gui/CellRenderers.py index 0bedf7a..fe17b3e 100644 --- a/src/Gui/CellRenderers.py +++ b/src/Gui/CellRenderers.py @@ -38,10 +38,7 @@ class MultilineCellRenderer(gtk.CellRendererText): def _on_editor_key_press_event(self, editor, event): if event.state & (gtk.gdk.SHIFT_MASK | gtk.gdk.CONTROL_MASK): return - if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter): - editor.remove_widget() - self.emit("edited", editor.get_data("path"), editor.get_text()) - elif event.keyval == gtk.keysyms.Escape: + if event.keyval == gtk.keysyms.Escape: editor.set_text(self.old_text) editor.remove_widget() self.emit("editing-canceled") diff --git a/src/Gui/ConfBackend.py b/src/Gui/ConfBackend.py index eb94b87..db25984 100644 --- a/src/Gui/ConfBackend.py +++ b/src/Gui/ConfBackend.py @@ -1,4 +1,3 @@ -from ABRTExceptions import ConfBackendInitError from abrt_utils import _ #FIXME: add some backend factory @@ -8,6 +7,15 @@ try: except ImportError, e: gkey = None +# Exceptions +class ConfBackendInitError(Exception): + def __init__(self, msg): + Exception.__init__(self) + self.what = msg + + def __str__(self): + return self.what + class ConfBackend(object): def __init__(self): pass @@ -24,9 +32,14 @@ class ConfBackend(object): class ConfBackendGnomeKeyring(ConfBackend): def __init__(self): ConfBackend.__init__(self) - self.default_key_ring = gkey.get_default_keyring_sync() if not gkey.is_available(): raise ConfBackendInitError(_("Can't connect do Gnome Keyring daemon")) + try: + self.default_key_ring = gkey.get_default_keyring_sync() + except: + # could happen if keyring daemon is running, but we run gui under + # user who is not owner is the running session - using su + raise ConfBackendInitError(_("Can't get default keyring")) def save(self, name, settings): settings_tmp = settings.copy() @@ -36,7 +49,7 @@ class ConfBackendGnomeKeyring(ConfBackend): item_list = [] try: item_list = gkey.find_items_sync(gkey.ITEM_GENERIC_SECRET, {"AbrtPluginInfo":str(name)}) - except gkey.NoMatchError, ex: + except gkey.NoMatchError: # nothing found pass @@ -59,7 +72,7 @@ class ConfBackendGnomeKeyring(ConfBackend): item_list = None try: item_list = gkey.find_items_sync(gkey.ITEM_GENERIC_SECRET, {"AbrtPluginInfo":str(name)}) - except gkey.NoMatchError, ex: + except gkey.NoMatchError: # nothing found pass diff --git a/src/Gui/SettingsDialog.py b/src/Gui/SettingsDialog.py index b3af501..cf42393 100644 --- a/src/Gui/SettingsDialog.py +++ b/src/Gui/SettingsDialog.py @@ -1,9 +1,8 @@ import sys import gtk -from PluginList import getPluginInfoList, PluginInfoList +from PluginList import getPluginInfoList from CC_gui_functions import * #from PluginSettingsUI import PluginSettingsUI -from ABRTPlugin import PluginSettings, PluginInfo from abrt_utils import _ @@ -75,11 +74,11 @@ class SettingsDialog: try: self.pluginlist = getPluginInfoList(self.ccdaemon, refresh=True) except Exception, e: - print "SettingsDialog: ", e + raise Exception("Comunication with daemon has failed, have you restarted the daemon after update?") ## hydrate cron jobs: for key,val in self.settings["Cron"].iteritems(): - # actionas are separated by ',' + # actions are separated by ',' actions = val.split(',') self.settings["Cron"][key] = actions for plugin in self.pluginlist.getActionPlugins(): @@ -120,11 +119,9 @@ class SettingsDialog: self.add_AnalyzerAction(action) def on_bCancelGPGKeys_clicked(self, button): - print "cancel" self.wGPGKeys.hide() def on_bSaveGPGKeys_clicked(self, button): - print "save" self.wGPGKeys.hide() def on_bAddGPGKey_clicked(self, button): @@ -233,9 +230,6 @@ class SettingsDialog: def on_bAddAction_clicked(self, button): self.add_AnalyzerAction() - def on_cancel_clicked(self,button): - self.window.hide() - def dehydrate(self): self.ccdaemon.setSettings(self.settings) diff --git a/src/Hooks/Makefile.am b/src/Hooks/Makefile.am index be1b1a2..4eb25e2 100644 --- a/src/Hooks/Makefile.am +++ b/src/Hooks/Makefile.am @@ -1,5 +1,5 @@ libexec_PROGRAMS = hookCCpp -bin_PROGRAMS = dumpoops +bin_PROGRAMS = dumpoops abrt-pyhook-helper # CCpp hookCCpp_SOURCES = \ @@ -29,6 +29,18 @@ dumpoops_CPPFLAGS = \ dumpoops_LDADD = \ ../../lib/Utils/libABRTUtils.la +# abrt-pyhook-helper +abrt_pyhook_helper_SOURCES = \ + abrt-pyhook-helper.cpp +abrt_pyhook_helper_CPPFLAGS = \ + -I$(srcdir)/../../inc \ + -I$(srcdir)/../../lib/Utils \ + -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ + -DVAR_RUN=\"$(VAR_RUN)\" \ + -D_GNU_SOURCE +abrt_pyhook_helper_LDADD = \ + ../../lib/Utils/libABRTUtils.la + man_MANS = pyhook.conf.5 python_PYTHON = sitecustomize.py abrt_exception_handler.py @@ -45,3 +57,7 @@ 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 + +install-data-hook: + chmod u+s,g+s $(DESTDIR)$(bindir)/abrt-pyhook-helper + diff --git a/src/Hooks/abrt-pyhook-helper.cpp b/src/Hooks/abrt-pyhook-helper.cpp new file mode 100644 index 0000000..4ac6ada --- /dev/null +++ b/src/Hooks/abrt-pyhook-helper.cpp @@ -0,0 +1,138 @@ +/* + python-hook-writer.cpp - writes data to the /var/cache/abrt directory + with SUID bit + + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#include <argp.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include "DebugDump.h" +#if HAVE_CONFIG_H +#include <config.h> +#endif + +const char *argp_program_version = "abrt-pyhook-helper " VERSION; +const char *argp_program_bug_address = "<crash-catcher@lists.fedorahosted.org>"; + +static char doc[] = "abrt-pyhook-helper -- stores crash data to abrt shared directory"; + +static struct argp_option options[] = { + {"pid" , 'p', "PID" , 0, "PID of process that caused the crash" }, + {"executable", 'e', "PATH" , 0, "absolute path to the program that crashed" }, + {"uuid" , 'u', "UUID" , 0, "hash generated from the backtrace"}, + {"cmdline" , 'c', "TEXT" , 0, "command line of the crashed program"}, + {"loginuid" , 'l', "UID" , 0, "login UID"}, + { 0 } +}; + +struct arguments +{ + char *pid; + char *executable; + char *uuid; + char *cmdline; + char *loginuid; +}; + +static error_t +parse_opt (int key, char *arg, struct argp_state *state) +{ + /* Get the input argument from argp_parse, which we + know is a pointer to our arguments structure. */ + struct arguments *arguments = (struct arguments*)state->input; + + switch (key) + { + case 'p': arguments->pid = arg; break; + case 'e': arguments->executable = arg; break; + case 'u': arguments->uuid = arg; break; + case 'c': arguments->cmdline = arg; break; + case 'l': arguments->loginuid = arg; break; + + case ARGP_KEY_ARG: + argp_usage(state); + exit(1); + break; + + case ARGP_KEY_END: + if (!arguments->pid) + { + argp_usage(state); + exit(1); + } + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +/* Our argp parser. */ +static struct argp argp = { options, parse_opt, 0, doc }; + +int main(int argc, char** argv) +{ + struct arguments arguments; + argp_parse (&argp, argc, argv, 0, 0, &arguments); + + char path[PATH_MAX]; + snprintf(path, sizeof(path), "%s/pyhook-%ld-%s", DEBUG_DUMPS_DIR, + (long)time(NULL), arguments.pid); + + CDebugDump dd; + dd.Create(path, geteuid()); + dd.SaveText(FILENAME_ANALYZER, "Python"); + if (arguments.executable) + dd.SaveText(FILENAME_EXECUTABLE, arguments.executable); + if (arguments.cmdline) + dd.SaveText("cmdline", arguments.cmdline); + if (arguments.uuid) + dd.SaveText("uuid", arguments.uuid); + if (arguments.loginuid) + dd.SaveText("uid", arguments.loginuid); + + // Read the backtrace from stdin. + int c; + int capacity = 1024; + char *bt = (char*)malloc(capacity); + char *btptr = bt; + while ((c = getchar()) != EOF) + { + if (c >= 0 && c <= 255) + *btptr++ = (char)c; + if (btptr - bt >= capacity - 1) + { + capacity *= 2; + bt = (char*)realloc(bt, capacity); + if (!bt) + { + printf("Error while allocating memory for backtrace."); + return 1; + } + } + } + *btptr = '\0'; + + dd.SaveText("backtrace", bt); + free(bt); + dd.Close(); + + return 0; +} diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in index 8ac7aa2..362aaf2 100644 --- a/src/Hooks/abrt_exception_handler.py.in +++ b/src/Hooks/abrt_exception_handler.py.in @@ -45,10 +45,10 @@ def exception_function(): import sys import os import syslog +import subprocess # abrt lib for saving debugdumps import ABRTUtils - __DUMPHASH = {} # FIXME: do length limits on obj dumps. def __dump_class(instance, fd, level=0): @@ -105,45 +105,20 @@ def __dump_class(instance, fd, level=0): fd.write("%s%s: %s\n" % (pad, key, value)) def write_dump(pid, tb_uuid, tb): - import time - ttime = int(time.time()) - # localstatedir - dir_name = "@DEBUG_DUMP_DIR@/pyhook-%s-%s" % (ttime, pid) - dd = ABRTUtils.CDebugDump() - try: - #os.mkdir(dir_name) - dd.Create(dir_name, os.getuid()) - except Exception, e: - syslog.syslog("abrt: Cannot create dir %s %s" % (dir_name, e)) - return - # save executable - fexecutable = open("%s/executable" % dir_name, "w") + executable = "Exception raised from python shell" if sys.argv[0]: - fexecutable.write(os.path.abspath(sys.argv[0])) - else: - fexecutable.write("Exception raised from python shell") - fexecutable.close() - # save coredump - coredump = open("%s/backtrace" % dir_name, "w") - coredump.write(tb) - coredump.close() - # save uuid - uuid = open("%s/uuid" % dir_name, "w") - uuid.write(tb_uuid) - uuid.close() - # save cmdline - cmdline = open("%s/cmdline" % dir_name, "w") - cmdline.write(open("/proc/%s/cmdline" % pid).read().replace('\x00',' ')) - cmdline.close() - # save uid - uid = open("%s/uid" % dir_name, "w") - uid.write(open("/proc/%s/loginuid" % pid).readlines()[0]) - uid.close() - # save analyzer - analyzer = open("%s/analyzer" % dir_name, "w") - analyzer.write("Python") - analyzer.close() - dd.Close() + executable = os.path.abspath(sys.argv[0]) + + command = ["abrt-pyhook-helper"] + command.append("--pid=%s" % pid) + command.append("--executable=%s" % executable) + command.append("--uuid=%s" % tb_uuid) + command.append("--cmdline=%s" % open("/proc/%s/cmdline" % pid).read().replace('\x00',' ')) + command.append("--loginuid=%s" % open("/proc/%s/loginuid" % pid).readlines()[0]) + + helper = subprocess.Popen(command, stdin=subprocess.PIPE) + helper.communicate(tb) + helper.wait() def __dump_exception(out, text, tracebk): 'write a traceback to "out"' diff --git a/src/Hooks/sitecustomize.py b/src/Hooks/sitecustomize.py index 56c6669..32a3747 100644 --- a/src/Hooks/sitecustomize.py +++ b/src/Hooks/sitecustomize.py @@ -1,14 +1,16 @@ +# ABRT crash hook +# # This special script is placed in # /usr/local/lib/pythonNNN/site-packages/sitecustomize.py # and python interpreter runs it automatically everytime -# some python script is executed +# some python script is executed. config = None conf = {} try: config = open("/etc/abrt/pyhook.conf","r") except: - #silently ignore if file doesn't exist + # Silently ignore if file doesn't exist. pass try: @@ -20,10 +22,14 @@ try: line = config.readline().lower().replace(' ','').strip('\n').split('=') conf[line[0]] = line[1] except: - # ignore silently everything, because we don't want to bother user if this hook doesn't work + # Ignore silently everything, because we don't want to bother user + # if this hook doesn't work. pass if conf.has_key("enabled"): + # Prevent abrt exception handler from running when the abrtd daemon is + # not active. + # abrtd sets the value to "no" when deactivated and vice versa. if conf["enabled"] == "yes": try: from abrt_exception_handler import * |
