diff options
-rw-r--r-- | src/daemon/MiddleWare.cpp | 22 | ||||
-rw-r--r-- | src/daemon/MiddleWare.h | 10 | ||||
-rw-r--r-- | src/daemon/abrt_event.conf | 4 | ||||
-rw-r--r-- | src/gui/CReporterAssistant.py | 54 | ||||
-rw-r--r-- | src/lib/dump_dir.c | 14 | ||||
-rw-r--r-- | src/lib/make_descr.cpp | 1 | ||||
-rw-r--r-- | src/plugins/CCpp.cpp | 16 | ||||
-rw-r--r-- | src/plugins/abrt-action-bugzilla.cpp | 1 |
8 files changed, 91 insertions, 31 deletions
diff --git a/src/daemon/MiddleWare.cpp b/src/daemon/MiddleWare.cpp index 1f849e9b..bd0e9689 100644 --- a/src/daemon/MiddleWare.cpp +++ b/src/daemon/MiddleWare.cpp @@ -37,16 +37,26 @@ CPluginManager* g_pPluginManager; /** + * Get one crash info. If getting is successful, + * then crash info is filled. + * @param dump_dir_name A dump dir containing all necessary data. + * @param pCrashData A crash info. + * @return It return results of operation. See mw_result_t. + */ +static mw_result_t FillCrashInfo(const char *crash_id, + map_crash_data_t& pCrashData); + +/** * Transforms a debugdump directory to inner crash * report form. This form is used for later reporting. - * @param pDebugDumpDir A debugdump dir containing all necessary data. + * @param dump_dir_name A debugdump dir containing all necessary data. * @param pCrashData A created crash report. */ -static bool DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& pCrashData) +static bool DebugDumpToCrashReport(const char *dump_dir_name, map_crash_data_t& pCrashData) { - VERB3 log(" DebugDumpToCrashReport('%s')", pDebugDumpDir); + VERB3 log(" DebugDumpToCrashReport('%s')", dump_dir_name); - struct dump_dir *dd = dd_opendir(pDebugDumpDir, /*flags:*/ 0); + struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0); if (!dd) return false; @@ -56,7 +66,7 @@ static bool DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& if (!dd_exist(dd, *v)) { dd_close(dd); - log("Important file '%s/%s' is missing", pDebugDumpDir, *v); + log("Important file '%s/%s' is missing", dump_dir_name, *v); return false; } v++; @@ -561,7 +571,7 @@ mw_result_t SaveDebugDump(const char *dump_dir_name, return res; } -mw_result_t FillCrashInfo(const char *crash_id, +static mw_result_t FillCrashInfo(const char *crash_id, map_crash_data_t& pCrashData) { CDatabase* database = g_pPluginManager->GetDatabase(g_settings_sDatabase); diff --git a/src/daemon/MiddleWare.h b/src/daemon/MiddleWare.h index bf7a5807..90386c03 100644 --- a/src/daemon/MiddleWare.h +++ b/src/daemon/MiddleWare.h @@ -102,16 +102,6 @@ report_status_t Report(const map_crash_data_t& crash_data, */ mw_result_t SaveDebugDump(const char *pDebugDumpDir, map_crash_data_t& pCrashData); -/** - * Get one crash info. If getting is successful, - * then crash info is filled. - * @param pUUID A local UUID of a crash. - * @param pUID An UID of an user. - * @param pCrashData A crash info. - * @return It return results of operation. See mw_result_t. - */ -mw_result_t FillCrashInfo(const char *crash_id, - map_crash_data_t& pCrashData); vector_map_crash_data_t GetCrashInfos(long caller_uid); int CreateReportThread(const char* crash_id, long caller_uid, int force, const char* pSender); diff --git a/src/daemon/abrt_event.conf b/src/daemon/abrt_event.conf index 58126192..6c1ac191 100644 --- a/src/daemon/abrt_event.conf +++ b/src/daemon/abrt_event.conf @@ -40,6 +40,10 @@ EVENT=post-create analyzer=Kerneloops abrt-action-analyze-oops #TODO: implement this (or add this functionality to abrt-action-install-debuginfo): #EVENT=analyze analyzer=CCpp backtrace= trim-debuginfo-cache /var/cache/abrt-di 4096m +# Additional directories to search for debuginfos can be specified +# in the third argument (its format is CACHEDIR[:DEBUGINFODIR...]). +# For example, you can specify a network-mounted shared store +# of all debuginfos this way. EVENT=analyze analyzer=CCpp backtrace= abrt-action-install-debuginfo "$DUMP_DIR/coredump" "/var/run/abrt/$$-$RANDOM" /var/cache/abrt-di EVENT=analyze analyzer=CCpp backtrace= abrt-action-generate-backtrace diff --git a/src/gui/CReporterAssistant.py b/src/gui/CReporterAssistant.py index 2165f1d0..5bcd603d 100644 --- a/src/gui/CReporterAssistant.py +++ b/src/gui/CReporterAssistant.py @@ -36,6 +36,7 @@ class ReporterAssistant(): self.howto_changed = False self.report_has_bt = False self.selected_report_events = [] + self.ev_warning = None """ create the assistant """ self.assistant = gtk.Assistant() self.assistant.set_icon_name("abrt") @@ -360,6 +361,7 @@ class ReporterAssistant(): except KeyError: buff.set_text(COMMENT_HINT_TEXT) self.comment_tev.set_buffer(buff) + self.on_howto_changed(self.howto_tev, None, self.howto_vbox, page) elif page == self.pdict_get_page(PAGE_CONFIRM): # howto if self.howto_changed: @@ -753,6 +755,49 @@ class ReporterAssistant(): page.pack_start(self.backtrace_cb, expand=False, fill=False) page.show_all() + def show_warning_for_tev(self, vbox, message): + if type(vbox) == gtk.VBox: + if not self.ev_warning: + lbl_warning = gtk.Label(message) + self.ev_warning = gtk.EventBox() + self.ev_warning.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#CC3333')) + self.ev_warning.add(lbl_warning) + vbox.pack_start(self.ev_warning, False, False) + self.ev_warning.show_all() + else: + log("Can't show warning because page is not a VBox") + + # TODO: per page warning + def hide_warning_for_tev(self, vbox=None): + if self.ev_warning: + self.ev_warning.hide() + + def is_howto_filled(self, howto_buff): + text = "" + start_it = howto_buff.get_start_iter() + end_it = howto_buff.get_end_iter() + text = howto_buff.get_text(start_it, end_it) + # ingore new lines and spaces in the text + clean_text = text.strip().replace("\n","").replace(" ","") + clean_howto_hint = HOW_TO_HINT_TEXT.strip().replace("\n","").replace(" ","") + # howto has to be longer then the hint + # and must not be same as the hint + if ( len(clean_text) >= len(clean_howto_hint) and + clean_text != clean_howto_hint + ): + return True + else: + return False + + def on_howto_changed(self, textview, event, vbox, page): + textbuffer = textview.get_buffer() + howto_filled = self.is_howto_filled(textbuffer) + if not howto_filled: + self.show_warning_for_tev(vbox, _("You need to fill the how to before you can proceed...")) + else: + self.hide_warning_for_tev() + self.assistant.set_page_complete(page, self.is_howto_filled(textbuffer)) + def prepare_page_3(self): page = gtk.VBox(spacing=10) page.set_border_width(10) @@ -770,7 +815,7 @@ class ReporterAssistant(): details_hbox.pack_start(details_alignment, expand=False, padding=30) # how to reproduce - howto_vbox = gtk.VBox(spacing=5) + self.howto_vbox = gtk.VBox(spacing=0) howto_lbl = gtk.Label(_("How did this crash happen (step-by-step)? " "How would you reproduce it?")) howto_lbl.set_alignment(0.0, 0.0) @@ -779,14 +824,15 @@ class ReporterAssistant(): self.howto_tev.set_wrap_mode(gtk.WRAP_WORD) self.howto_tev.set_accepts_tab(False) self.howto_tev.connect("focus-out-event", self.on_howto_focusout_cb) + self.howto_tev.connect("key-release-event", self.on_howto_changed, self.howto_vbox, page) howto_buff = gtk.TextBuffer() howto_buff.set_text(HOW_TO_HINT_TEXT) self.howto_tev.set_buffer(howto_buff) howto_scroll_w = gtk.ScrolledWindow() howto_scroll_w.add(self.howto_tev) howto_scroll_w.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - howto_vbox.pack_start(howto_lbl, expand=False, fill=True) - howto_vbox.pack_start(howto_scroll_w) + self.howto_vbox.pack_start(howto_lbl, expand=False, fill=True) + self.howto_vbox.pack_start(howto_scroll_w) # comment comment_vbox = gtk.VBox(spacing=5) @@ -805,7 +851,7 @@ class ReporterAssistant(): comment_vbox.pack_start(comment_lbl, expand=False, fill=True) comment_vbox.pack_start(comment_scroll_w) - details_vbox.pack_start(howto_vbox) + details_vbox.pack_start(self.howto_vbox) details_vbox.pack_start(comment_vbox) self.assistant.insert_page(page, PAGE_EXTRA_INFO) self.pdict_add_page(page, PAGE_EXTRA_INFO) diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c index 3778aa85..19c49ce7 100644 --- a/src/lib/dump_dir.c +++ b/src/lib/dump_dir.c @@ -378,16 +378,26 @@ static char *load_text_file(const char *path, unsigned flags) } struct strbuf *buf_content = strbuf_new(); + int oneline = 0; int ch; while ((ch = fgetc(fp)) != EOF) { + if (ch == '\n') + oneline = (oneline << 1) | 1; if (ch == '\0') - strbuf_append_char(buf_content, ' '); - else if (isspace(ch) || (isascii(ch) && !iscntrl(ch))) + ch = ' '; + if (isspace(ch) || (isascii(ch) && !iscntrl(ch))) strbuf_append_char(buf_content, ch); } fclose(fp); + /* If file contains exactly one '\n' and it is at the end, remove it. + * This enables users to use simple "echo blah >file" in order to create + * short string items in dump dirs. + */ + if (oneline == 1 && buf_content->buf[buf_content->len - 1] == '\n') + buf_content->buf[--buf_content->len] = '\0'; + return strbuf_free_nobuf(buf_content); } diff --git a/src/lib/make_descr.cpp b/src/lib/make_descr.cpp index 79065100..33f45b9d 100644 --- a/src/lib/make_descr.cpp +++ b/src/lib/make_descr.cpp @@ -69,7 +69,6 @@ static const char *const blacklisted_items[] = { FILENAME_DUPHASH , CD_UUID , CD_INFORMALL , - FILENAME_DUPHASH , CD_DUMPDIR , CD_COUNT , CD_REPORTED , diff --git a/src/plugins/CCpp.cpp b/src/plugins/CCpp.cpp index 9f03d947..e6807ea7 100644 --- a/src/plugins/CCpp.cpp +++ b/src/plugins/CCpp.cpp @@ -30,13 +30,15 @@ using namespace std; #define CORE_PATTERN "|"CCPP_HOOK_PATH" "DEBUG_DUMPS_DIR" %p %s %u %c" #define CORE_PIPE_LIMIT_IFACE "/proc/sys/kernel/core_pipe_limit" /* core_pipe_limit specifies how many dump_helpers might run at the same time -0 - means unlimited, but the it's not guaranteed that /proc/<pid> of crashing -process might not be available for dump_helper -4 - means that 4 dump_helpers can run at the same time, which should be enough -for ABRT, we can miss some crashes, but what are the odds that more processes -crash at the same time? This value has been recommended by nhorman -*/ -#define CORE_PIPE_LIMIT "4" + * 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? + * The value of 4 has been recommended by nhorman. + */ +#define CORE_PIPE_LIMIT "4" #define DEBUGINFO_CACHE_DIR LOCALSTATEDIR"/cache/abrt-di" diff --git a/src/plugins/abrt-action-bugzilla.cpp b/src/plugins/abrt-action-bugzilla.cpp index a3c2f0b0..90c7d3b5 100644 --- a/src/plugins/abrt-action-bugzilla.cpp +++ b/src/plugins/abrt-action-bugzilla.cpp @@ -846,7 +846,6 @@ int main(int argc, char **argv) switch (opt) { case 'c': - dump_dir_name = optarg; VERB1 log("Loading settings from '%s'", optarg); LoadPluginSettings(optarg, settings); VERB3 log("Loaded '%s'", optarg); |