diff options
| author | Jiri Moskovcak <jmoskovc@redhat.com> | 2010-01-29 17:19:48 +0100 |
|---|---|---|
| committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2010-01-29 17:19:48 +0100 |
| commit | 3583c9184c37fc13e9a5135a8d99312bfceaa39c (patch) | |
| tree | 3d8c46079ac88dced18c49ec712d300df3de2832 /src | |
| parent | cfbb554000b1e3fdce90bbf14c4c2f78a5a73340 (diff) | |
| parent | e362e4141068671638865b19996bf44341c6af11 (diff) | |
Merge branch 'rhel6' of ssh://git.fedorahosted.org/git/abrt into rhel6
Diffstat (limited to 'src')
| -rw-r--r-- | src/Daemon/MiddleWare.cpp | 10 | ||||
| -rw-r--r-- | src/Gui/ABRTPlugin.py | 10 | ||||
| -rw-r--r-- | src/Gui/CCReporterDialog.py | 26 | ||||
| -rw-r--r-- | src/Gui/CC_gui_functions.py | 10 | ||||
| -rw-r--r-- | src/Gui/ConfBackend.py | 63 | ||||
| -rw-r--r-- | src/Gui/abrt_utils.py | 5 | ||||
| -rw-r--r-- | src/Gui/report.glade | 11 |
7 files changed, 101 insertions, 34 deletions
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index ba7e0a0..f69c8a3 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -383,10 +383,13 @@ report_status_t Report(const map_crash_data_t& client_report, const std::string& pDumpDir = get_crash_data_item_content(stored_report, CD_DUMPDIR); // Save comment, "how to reproduce", backtrace +//TODO: we should iterate through stored_report and modify all +//modifiable fields which have new data in client_report const char *comment = get_crash_data_item_content_or_NULL(client_report, FILENAME_COMMENT); const char *reproduce = get_crash_data_item_content_or_NULL(client_report, FILENAME_REPRODUCE); const char *backtrace = get_crash_data_item_content_or_NULL(client_report, FILENAME_BACKTRACE); - if (comment || reproduce || backtrace) + const char *kerneloops = get_crash_data_item_content_or_NULL(client_report, FILENAME_KERNELOOPS); + if (comment || reproduce || backtrace || kerneloops) { CDebugDump dd; dd.Open(pDumpDir.c_str()); @@ -405,6 +408,11 @@ report_status_t Report(const map_crash_data_t& client_report, dd.SaveText(FILENAME_BACKTRACE, backtrace); add_to_crash_data_ext(stored_report, FILENAME_BACKTRACE, CD_TXT, CD_ISEDITABLE, backtrace); } + if (kerneloops) + { + dd.SaveText(FILENAME_KERNELOOPS, kerneloops); + add_to_crash_data_ext(stored_report, FILENAME_KERNELOOPS, CD_TXT, CD_ISEDITABLE, kerneloops); + } } const std::string& analyzer = get_crash_data_item_content(stored_report, FILENAME_ANALYZER); diff --git a/src/Gui/ABRTPlugin.py b/src/Gui/ABRTPlugin.py index 320c81c..f32a593 100644 --- a/src/Gui/ABRTPlugin.py +++ b/src/Gui/ABRTPlugin.py @@ -39,7 +39,15 @@ class PluginSettings(dict): self[str(key)] = str(daemon_settings[key]) if self.client_side_conf: - settings = self.client_side_conf.load(name) + # FIXME: this fails when gk-authoriaztion fails + # we need to show a dialog to user and let him know + # for now just silently ignore it to avoid rhbz#559342 + settings = {} + try: + settings = self.client_side_conf.load(name) + except Exception, e: + print e + pass # overwrite daemon data with user setting for key in settings.keys(): # only rewrite keys which exist in plugin's keys. diff --git a/src/Gui/CCReporterDialog.py b/src/Gui/CCReporterDialog.py index 74cf37e..816164b 100644 --- a/src/Gui/CCReporterDialog.py +++ b/src/Gui/CCReporterDialog.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import pygtk pygtk.require("2.0") -import gtk #, pango +import gtk import gtk.glade import pango import sys @@ -12,7 +12,7 @@ from PluginSettingsUI import PluginSettingsUI from PluginList import getPluginInfoList #from CCDumpList import getDumpList, DumpList from CCDump import * # FILENAME_xxx, CD_xxx -from abrt_utils import _, log, log1, log2 +from abrt_utils import _, log, log1, log2, get_verbose_level, g_verbose # FIXME - create method or smth that returns type|editable|content @@ -51,7 +51,12 @@ class ReporterDialog(): self.tevHowToReproduce = self.builder.get_object("tevHowToReproduce") self.builder.get_object("fErrors").hide() - self.builder.get_object("bLog").connect("clicked", self.show_log_cb, log) + bLog = self.builder.get_object("bLog") + #if g_verbose > 0: - doesn't work! why?! + if get_verbose_level() > 0: + bLog.connect("clicked", self.show_log_cb, log) + else: + bLog.unset_flags(gtk.VISIBLE) self.builder.get_object("cbSendBacktrace").connect("toggled", self.on_send_backtrace_toggled) self.allow_send() self.hydrate() @@ -84,16 +89,16 @@ class ReporterDialog(): send = True error_msgs = [] try: - rating = self.report[FILENAME_RATING] + rating = int(self.report[FILENAME_RATING][CD_CONTENT]) except: rating = None # active buttons acording to required fields # if an backtrace has rating use it if not SendBacktrace: send = False - error_msgs.append(_("You must agree with submitting the backtrace.")) + error_msgs.append(_("You must check backtrace for sensitive data")) # we have both SendBacktrace and rating - if rating: + if rating != None: try: package = self.report[FILENAME_PACKAGE][CD_CONTENT] # if we don't have package for some reason @@ -105,6 +110,7 @@ class ReporterDialog(): error_msgs.append(_("Reporting disabled because the backtrace is unusable.\nPlease try to install debuginfo manually using command: <b>debuginfo-install %s</b> \nthen use Refresh button to regenerate the backtrace." % package[0:package.rfind('-',0,package.rfind('-'))])) else: error_msgs.append(_("The backtrace is unusable, you can't report this!")) + send = False # probably usable 3 elif int(self.report[FILENAME_RATING][CD_CONTENT]) < 4: error_msgs.append(_("The backtrace is incomplete, please make sure you provide good steps to reproduce.")) @@ -214,7 +220,8 @@ class ReporterDialog(): except: pass - if item == FILENAME_BACKTRACE: + if item == FILENAME_BACKTRACE or item == FILENAME_KERNELOOPS: + self.is_oops = item == FILENAME_KERNELOOPS buff = gtk.TextBuffer() tvBacktrace = self.builder.get_object("tvBacktrace") buff.set_text(self.report[item][CD_CONTENT]) @@ -303,7 +310,10 @@ class ReporterDialog(): tev_backtrace = self.builder.get_object("tvBacktrace") buff = tev_backtrace.get_buffer() text = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) - self.report[FILENAME_BACKTRACE] = [CD_TXT, 'y', text] + if self.is_oops: + self.report[FILENAME_KERNELOOPS] = [CD_TXT, 'y', text] + else: + self.report[FILENAME_BACKTRACE] = [CD_TXT, 'y', text] def check_report(self): # FIXME: check the report for passwords and some other potentially diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py index 708a151..1a23db1 100644 --- a/src/Gui/CC_gui_functions.py +++ b/src/Gui/CC_gui_functions.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import gtk +import pango import subprocess import sys # url markup is supported from gtk 2.17 so we need to use libsexy @@ -34,7 +35,7 @@ def gui_report_dialog ( report_status_dict, parent_dialog, builderfile = "%s%sdialogs.glade" % (sys.path[0],"/") builder.add_from_file(builderfile) dialog = builder.get_object("ReportDialog") - dialog.set_default_size(200, 50) + dialog.set_default_size(360, 50) dialog.set_resizable(False) main_hbox = builder.get_object("main_hbox") @@ -50,11 +51,13 @@ def gui_report_dialog ( report_status_dict, parent_dialog, plugin_label.set_alignment(0, 0) status_label = gtk.Label() status_label.set_max_width_chars(MAX_WIDTH) + status_label.set_size_request(360,-1) status_label.set_selectable(True) status_label.set_line_wrap(True) + status_label.set_line_wrap_mode(pango.WRAP_CHAR) status_label.set_alignment(0, 0) plugin_status_vbox.pack_start(plugin_label, expand=False) - plugin_status_vbox.pack_start(status_label, expand=False) + plugin_status_vbox.pack_start(status_label, fill=True, expand=True) # 0 means not succesfull #if report_status_dict[plugin][0] == '0': # this first one is actually a fallback to set at least @@ -72,8 +75,9 @@ def gui_report_dialog ( report_status_dict, parent_dialog, else: status_label.set_text("%s" % report_status_dict[plugin][1]) if len(report_status_dict[plugin][1]) > MAX_WIDTH: + print "setting tooltip for %s" % report_status_dict[plugin][1] status_label.set_tooltip_text(report_status_dict[plugin][1]) - status_vbox.pack_start(plugin_status_vbox, expand=False) + status_vbox.pack_start(plugin_status_vbox, fill=True, expand=False) main_hbox.pack_start(status_vbox) if widget != None: diff --git a/src/Gui/ConfBackend.py b/src/Gui/ConfBackend.py index 0d47760..741f200 100644 --- a/src/Gui/ConfBackend.py +++ b/src/Gui/ConfBackend.py @@ -26,6 +26,14 @@ class ConfBackendSaveError(Exception): def __str__(self): return self.what +class ConfBackendLoadError(Exception): + def __init__(self, msg): + Exception.__init__(self) + self.what = msg + + def __str__(self): + return self.what + class ConfBackend(object): def __init__(self): @@ -111,26 +119,41 @@ class ConfBackendGnomeKeyring(ConfBackend): def load(self, name): item_list = None - try: - log2("looking for keyring items with 'AbrtPluginInfo:%s' attr", str(name)) - item_list = gkey.find_items_sync(gkey.ITEM_GENERIC_SECRET, {"AbrtPluginInfo":str(name)}) - for item in item_list: - # gnome keyring is weeeeird. why display_name, type, mtime, ctime - # aren't available in find_items_sync() results? why we need to - # get them via additional call, item_get_info_sync()? - # internally, item has GNOME_KEYRING_TYPE_FOUND type, - # and info has GNOME_KEYRING_TYPE_ITEM_INFO type. - # why not use the same type for both? - # - # and worst of all, this information took four hours of googling... - # - #info = gkey.item_get_info_sync(item.keyring, item.item_id) - log2("found keyring item: ring:'%s' item_id:%s attrs:%s", # "secret:'%s' display_name:'%s'" - item.keyring, item.item_id, str(item.attributes) #, item.secret, info.get_display_name() - ) - except gkey.NoMatchError: - # nothing found - pass + #FIXME: make this configurable + # this actually makes GUI to ask twice per every plugin + # which have it's settings stored in keyring + attempts = 2 + while attempts: + try: + log2("looking for keyring items with 'AbrtPluginInfo:%s' attr", str(name)) + item_list = gkey.find_items_sync(gkey.ITEM_GENERIC_SECRET, {"AbrtPluginInfo":str(name)}) + for item in item_list: + # gnome keyring is weeeeird. why display_name, type, mtime, ctime + # aren't available in find_items_sync() results? why we need to + # get them via additional call, item_get_info_sync()? + # internally, item has GNOME_KEYRING_TYPE_FOUND type, + # and info has GNOME_KEYRING_TYPE_ITEM_INFO type. + # why not use the same type for both? + # + # and worst of all, this information took four hours of googling... + # + #info = gkey.item_get_info_sync(item.keyring, item.item_id) + log2("found keyring item: ring:'%s' item_id:%s attrs:%s", # "secret:'%s' display_name:'%s'" + item.keyring, item.item_id, str(item.attributes) #, item.secret, info.get_display_name() + ) + except gkey.NoMatchError: + # nothing found + pass + except gkey.DeniedError, e: + attempts -= 1 + log2("gk-authorization has failed %i time(s)", 2-attempts) + if attempts == 0: + # we tried 2 times, so giving up the authorization + print "raising exception" + raise ConfBackendLoadError(_("Access to gnome-keyring has been denied, can't load the settings for %s!" % name)) + continue + break + if item_list: retval = item_list[0].attributes.copy() retval["Password"] = item_list[0].secret diff --git a/src/Gui/abrt_utils.py b/src/Gui/abrt_utils.py index 3b0bb79..13ef499 100644 --- a/src/Gui/abrt_utils.py +++ b/src/Gui/abrt_utils.py @@ -25,6 +25,11 @@ def init_logging(progname, v): gtk.glade.textdomain(PROGNAME) gettext.textdomain(PROGNAME) +def get_verbose_level(): + # Just importing g_verbose from another module doesn't work (why!?), + # need to use a function + return g_verbose + def log(fmt, *args): sys.stderr.write("%s: %s\n" % (PROGNAME, fmt % args)) diff --git a/src/Gui/report.glade b/src/Gui/report.glade index ff375f7..13e4c14 100644 --- a/src/Gui/report.glade +++ b/src/Gui/report.glade @@ -96,6 +96,7 @@ <property name="xalign">0</property> <property name="xpad">5</property> <property name="label" translatable="yes">N/A</property> + <property name="selectable">True</property> <property name="max_width_chars">40</property> </object> <packing> @@ -108,6 +109,7 @@ <property name="xalign">0</property> <property name="xpad">5</property> <property name="label" translatable="yes">N/A</property> + <property name="selectable">True</property> <property name="max_width_chars">40</property> </object> <packing> @@ -120,6 +122,7 @@ <property name="xalign">0</property> <property name="xpad">5</property> <property name="label" translatable="yes">N/A</property> + <property name="selectable">True</property> <property name="max_width_chars">40</property> </object> <packing> @@ -132,6 +135,7 @@ <property name="xalign">0</property> <property name="xpad">5</property> <property name="label" translatable="yes">N/A</property> + <property name="selectable">True</property> <property name="max_width_chars">40</property> </object> <packing> @@ -209,6 +213,7 @@ <property name="xalign">0</property> <property name="xpad">5</property> <property name="label" translatable="yes">N/A</property> + <property name="selectable">True</property> <property name="max_width_chars">40</property> </object> <packing> @@ -221,6 +226,7 @@ <property name="xalign">0</property> <property name="xpad">5</property> <property name="label" translatable="yes">N/A</property> + <property name="selectable">True</property> <property name="max_width_chars">40</property> </object> <packing> @@ -233,6 +239,7 @@ <property name="xalign">0</property> <property name="xpad">5</property> <property name="label" translatable="yes">N/A</property> + <property name="selectable">True</property> <property name="max_width_chars">40</property> </object> <packing> @@ -245,6 +252,7 @@ <property name="xalign">0</property> <property name="xpad">5</property> <property name="label" translatable="yes">N/A</property> + <property name="selectable">True</property> <property name="max_width_chars">40</property> </object> <packing> @@ -304,7 +312,7 @@ </child> <child> <object class="GtkCheckButton" id="cbSendBacktrace"> - <property name="label" translatable="yes">I agree to submit this backtrace, which could contain sensitive data</property> + <property name="label" translatable="yes">I checked backtrace and removed sensitive data (passwords, etc)</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -591,6 +599,7 @@ <property name="expand">False</property> <property name="fill">False</property> <property name="position">0</property> + <property name="secondary">True</property> </packing> </child> <child> |
