[SATYR PATCH 1/3] Fix paths in public headers
by Martin Milata
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
include/core/frame.h | 2 +-
include/core/stacktrace.h | 2 +-
include/core/thread.h | 2 +-
include/gdb/frame.h | 2 +-
include/gdb/stacktrace.h | 2 +-
include/gdb/thread.h | 2 +-
include/java/frame.h | 2 +-
include/java/stacktrace.h | 2 +-
include/java/thread.h | 2 +-
include/koops/frame.h | 2 +-
include/koops/stacktrace.h | 2 +-
include/python/frame.h | 2 +-
include/python/stacktrace.h | 2 +-
13 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/include/core/frame.h b/include/core/frame.h
index c7817db..cc6c462 100644
--- a/include/core/frame.h
+++ b/include/core/frame.h
@@ -29,7 +29,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <inttypes.h>
#include <stdbool.h>
diff --git a/include/core/stacktrace.h b/include/core/stacktrace.h
index 765bdec..2169ef7 100644
--- a/include/core/stacktrace.h
+++ b/include/core/stacktrace.h
@@ -29,7 +29,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <inttypes.h>
struct sr_core_thread;
diff --git a/include/core/thread.h b/include/core/thread.h
index 23bfd59..42617e5 100644
--- a/include/core/thread.h
+++ b/include/core/thread.h
@@ -29,7 +29,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
#include <inttypes.h>
diff --git a/include/gdb/frame.h b/include/gdb/frame.h
index a9b71bd..06dfc0e 100644
--- a/include/gdb/frame.h
+++ b/include/gdb/frame.h
@@ -29,7 +29,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
#include <stdint.h>
diff --git a/include/gdb/stacktrace.h b/include/gdb/stacktrace.h
index f7eff36..ed63f82 100644
--- a/include/gdb/stacktrace.h
+++ b/include/gdb/stacktrace.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
struct sr_gdb_thread;
diff --git a/include/gdb/thread.h b/include/gdb/thread.h
index f601b8f..8970f65 100644
--- a/include/gdb/thread.h
+++ b/include/gdb/thread.h
@@ -29,7 +29,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
#include <stdint.h>
diff --git a/include/java/frame.h b/include/java/frame.h
index b1be1c9..57eb96e 100644
--- a/include/java/frame.h
+++ b/include/java/frame.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
#include <stdint.h>
diff --git a/include/java/stacktrace.h b/include/java/stacktrace.h
index ef16918..e58c08c 100644
--- a/include/java/stacktrace.h
+++ b/include/java/stacktrace.h
@@ -33,7 +33,7 @@ extern "C" {
struct sr_java_thread;
struct sr_location;
-#include "report_type.h"
+#include "../report_type.h"
#include <stdint.h>
struct sr_java_stacktrace
diff --git a/include/java/thread.h b/include/java/thread.h
index 0fd8c6e..cf10a6d 100644
--- a/include/java/thread.h
+++ b/include/java/thread.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
#include <stdint.h>
diff --git a/include/koops/frame.h b/include/koops/frame.h
index 269fb73..cc69904 100644
--- a/include/koops/frame.h
+++ b/include/koops/frame.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
#include <stdint.h>
diff --git a/include/koops/stacktrace.h b/include/koops/stacktrace.h
index 9d76cab..85bc755 100644
--- a/include/koops/stacktrace.h
+++ b/include/koops/stacktrace.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
#include <inttypes.h>
#include <stddef.h>
diff --git a/include/python/frame.h b/include/python/frame.h
index a02a6b1..362b402 100644
--- a/include/python/frame.h
+++ b/include/python/frame.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdbool.h>
#include <stdint.h>
diff --git a/include/python/stacktrace.h b/include/python/stacktrace.h
index 22c9f02..6223dc1 100644
--- a/include/python/stacktrace.h
+++ b/include/python/stacktrace.h
@@ -30,7 +30,7 @@
extern "C" {
#endif
-#include "report_type.h"
+#include "../report_type.h"
#include <stdint.h>
struct sr_python_frame;
--
1.7.11.7
10 years, 12 months
[SATYR PATCH 0/3] Implement bthashes
by Martin Milata
Related to https://github.com/abrt/satyr/issues/66, duphash implementation will
follow.
Martin Milata (3):
Higher-level function for SHA1 hashes in hex encoding
Implement bthashes
python: bindings for bthash
include/stacktrace.h | 22 ++++++++++++++++++
lib/core_fingerprint.c | 10 +-------
lib/core_frame.c | 23 +++++++++++++++++++
lib/core_stacktrace.c | 15 ++++++++++++
lib/core_thread.c | 3 +++
lib/gdb_frame.c | 24 +++++++++++++++++++
lib/gdb_stacktrace.c | 21 +++++++++++++++++
lib/gdb_thread.c | 14 ++++++++++++
lib/generic_frame.c | 9 ++++++++
lib/generic_frame.h | 9 ++++++++
lib/generic_stacktrace.c | 43 ++++++++++++++++++++++++++++++++++
lib/generic_stacktrace.h | 4 ++++
lib/generic_thread.c | 16 +++++++++++++
lib/generic_thread.h | 14 ++++++++++++
lib/internal_utils.h | 3 +++
lib/java_frame.c | 22 ++++++++++++++++++
lib/java_stacktrace.c | 9 ++++++++
lib/java_thread.c | 13 +++++++++++
lib/koops_frame.c | 27 ++++++++++++++++++++++
lib/koops_stacktrace.c | 34 +++++++++++++++++++++++++++
lib/python_frame.c | 21 +++++++++++++++++
lib/python_stacktrace.c | 16 +++++++++++++
lib/sha1.c | 16 +++++++++++++
lib/sha1.h | 5 ++++
python/py_base_stacktrace.c | 56 +++++++++++++++++++++++++++++++++++++++++++++
python/py_base_stacktrace.h | 2 ++
python/py_module.c | 4 ++++
tests/python/gdb.py | 3 +++
tests/python/java.py | 2 ++
tests/python/koops.py | 3 +++
tests/python/python.py | 3 +++
31 files changed, 457 insertions(+), 9 deletions(-)
--
1.7.11.7
10 years, 12 months
[LIBREPORT PATCH 1/2] rhbz: test rhbz_new_bug() return value for errors
by Jakub Filak
Related to rhbz#980228
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/plugins/reporter-bugzilla.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index d0e04b6..626b41f 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -1240,6 +1240,11 @@ int main(int argc, char **argv)
free(bzcomment);
free(summary);
+ if (new_id == -1)
+ {
+ error_msg_and_die(_("Failed to create a new bug."));
+ }
+
log(_("Adding attachments to bug %i"), new_id);
char new_id_str[sizeof(int)*3 + 2];
sprintf(new_id_str, "%i", new_id);
--
1.8.2.1
10 years, 12 months
[ABRT PATCH 1/2] problem API: add function getting list of inaccessible problem IDs
by Jakub Filak
Related to rhbz#973125
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/include/problem_api.h | 31 ++++++++++++++++++++++++++++++-
src/lib/problem_api.c | 31 ++++++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/src/include/problem_api.h b/src/include/problem_api.h
index 99d832c..60a76d0 100644
--- a/src/include/problem_api.h
+++ b/src/include/problem_api.h
@@ -20,9 +20,29 @@
#include <glib.h>
#include <libabrt.h>
+
+/*
+ * Function called for each problem directory in @for_each_problem_in_dir
+ *
+ * @param dd A dump directory
+ * @param arg User's arguments
+ * @returns 0 if everything is OK, a non zero value in order to break the iterator
+ */
+typedef int (* for_each_problem_in_dir_callback)(struct dump_dir *dd, void *arg);
+
+/*
+ * Iterates over all dump directories placed in @path and call @callback.
+ *
+ * @param path Dump directories location
+ * @param caller_uid UID for access check. -1 for disabling this check
+ * @param callback Called for each applicable dump directory. Non zero
+ * value returned from @callback will breaks the iteration.
+ * @param arg User's arguments passed to @callback
+ * @returns 0 or the first non zero value returned from @callback
+ */
int for_each_problem_in_dir(const char *path,
uid_t caller_uid,
- int (*callback)(struct dump_dir *dd, void *arg),
+ for_each_problem_in_dir_callback callback,
void *arg);
/* Retrieves the list of directories currently used as a problem storage
@@ -31,3 +51,12 @@ int for_each_problem_in_dir(const char *path,
*/
GList *get_problem_storages(void);
GList *get_problem_dirs_for_uid(uid_t uid, const char *dump_location);
+
+/*
+ * Gets list of problem directories not accessible by user
+ *
+ * @param uid User's uid
+ * @param dump_location Dump directories location
+ * @returns GList with mallocated absolute paths to dump directories
+ */
+GList *get_problem_dirs_not_accessible_by_uid(uid_t uid, const char *dump_location);
diff --git a/src/lib/problem_api.c b/src/lib/problem_api.c
index 3bb114f..7523efb 100644
--- a/src/lib/problem_api.c
+++ b/src/lib/problem_api.c
@@ -46,7 +46,7 @@ int for_each_problem_in_dir(const char *path,
continue; /* skip "." and ".." */
char *full_name = concat_path_file(path, dent->d_name);
- if (dump_dir_accessible_by_uid(full_name, caller_uid))
+ if (caller_uid == -1 || dump_dir_accessible_by_uid(full_name, caller_uid))
{
/* Silently ignore *any* errors, not only EACCES.
* We saw "lock file is locked by process PID" error
@@ -91,6 +91,35 @@ GList *get_problem_dirs_for_uid(uid_t uid, const char *dump_location)
return g_list_reverse(list);
}
+/* get_problem_dirs_not_accessible_by_uid and its helpers */
+struct add_dirname_to_GList_if_not_accessible_args
+{
+ uid_t uid;
+ GList *list;
+};
+
+static int add_dirname_to_GList_if_not_accessible(struct dump_dir *dd, void *args)
+{
+ struct add_dirname_to_GList_if_not_accessible_args *param = (struct add_dirname_to_GList_if_not_accessible_args *)args;
+ /* Append if not accessible */
+ if (!dump_dir_accessible_by_uid(dd->dd_dirname, param->uid))
+ param->list = g_list_prepend(param->list, xstrdup(dd->dd_dirname));
+
+ return 0;
+}
+
+GList *get_problem_dirs_not_accessible_by_uid(uid_t uid, const char *dump_location)
+{
+ struct add_dirname_to_GList_if_not_accessible_args args = {
+ .uid = uid,
+ .list = NULL,
+ };
+
+ for_each_problem_in_dir(dump_location, /*disable default uid check*/-1, add_dirname_to_GList_if_not_accessible, &args);
+ return g_list_reverse(args.list);
+}
+
+
/* get_problem_storages */
GList *get_problem_storages(void)
--
1.8.2.1
10 years, 12 months
[ABRT PATCH] the system tray icon opens recently detected problem
by Jakub Filak
Related to rhbz#973125
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/applet/applet.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/src/applet/applet.c b/src/applet/applet.c
index 4773d06..568237a 100644
--- a/src/applet/applet.c
+++ b/src/applet/applet.c
@@ -63,12 +63,13 @@ enum
static GDBusConnection *g_system_bus;
static GtkStatusIcon *ap_status_icon;
static GtkWidget *ap_menu;
-static char *ap_last_problem_dir;
static char **s_dirs;
static GList *g_deferred_crash_queue;
static guint g_deferred_timeout;
static int g_signal_pipe[2];
static ignored_problems_t *g_ignore_set;
+/* Used only for selection of the last notified problem if a user clicks on the systray icon */
+static char *g_last_notified_problem_id;
static bool is_autoreporting_enabled(void)
{
@@ -744,7 +745,7 @@ static GtkWidget *create_menu(void)
static void on_applet_activate_cb(GtkStatusIcon *status_icon, gpointer user_data)
{
- fork_exec_gui(/* problem id */ NULL);
+ fork_exec_gui(g_last_notified_problem_id);
hide_icon();
}
@@ -799,16 +800,21 @@ static void notify_problem_list(GList *problems, int flags)
/* show icon and don't try to show notify if initialization of libnotify failed */
flags |= SHOW_ICON_ONLY;
+ GList *last_item = g_list_last(problems);
+ if (last_item == NULL)
+ {
+ VERB3 log("Not showing any notification bubble because the list of problems is empty.");
+ return;
+ }
+
+ problem_info_t *last_problem = (problem_info_t *)last_item->data;
+ free(g_last_notified_problem_id);
+ g_last_notified_problem_id = xstrdup(last_problem->problem_dir);
+
if (!persistence_supported || flags & SHOW_ICON_ONLY)
{
/* Use a message of the last one */
- GList *last = g_list_last(problems);
-
- if (last)
- {
- problem_info_t *pi = (problem_info_t *)last->data;
- show_icon(pi->message);
- }
+ show_icon(last_problem->message);
}
if (flags & SHOW_ICON_ONLY)
@@ -1167,10 +1173,11 @@ static void Crash(DBusMessage* signal)
*/
static time_t last_time = 0;
static char* last_package_name = NULL;
+ static char *last_problem_dir = NULL;
time_t cur_time = time(NULL);
int flags = 0;
if (last_package_name && strcmp(last_package_name, package_name) == 0
- && ap_last_problem_dir && strcmp(ap_last_problem_dir, dir) == 0
+ && last_problem_dir && strcmp(last_problem_dir, dir) == 0
&& (unsigned)(cur_time - last_time) < 2 * 60 * 60
) {
/* log_msg doesn't show in .xsession_errors */
@@ -1182,8 +1189,8 @@ static void Crash(DBusMessage* signal)
last_time = cur_time;
free(last_package_name);
last_package_name = xstrdup(package_name);
- free(ap_last_problem_dir);
- ap_last_problem_dir = xstrdup(dir);
+ free(last_problem_dir);
+ last_problem_dir = xstrdup(dir);
}
problem_info_t *pi = problem_info_new();
@@ -1531,5 +1538,7 @@ next:
g_dbus_connection_signal_unsubscribe(g_system_bus, signal_ret);
g_object_unref(g_system_bus);
+ free(g_last_notified_problem_id);
+
return 0;
}
--
1.8.2.1
10 years, 12 months
[LIBREPORT PATCH] wizard: show accurate messages
by Jakub Filak
Closes rhbz#973167
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gui-wizard-gtk/wizard.c | 36 ++++++++++++------------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 9c867ca..1c7d75d 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -113,7 +113,7 @@ static GtkWidget *g_top_most_window;
static void add_workflow_buttons(GtkBox *box, GHashTable *workflows, GCallback func);
static void set_auto_event_chain(GtkButton *button, gpointer user_data);
-static void setup_and_start_event_run(const char *event_name);
+static void start_event_run(const char *event_name);
typedef struct
{
@@ -1348,7 +1348,6 @@ struct analyze_event_data
struct run_event_state *run_state;
char *event_name;
GList *env_list;
- const char *success_msg;
GIOChannel *channel;
struct strbuf *event_log;
int event_log_state;
@@ -1677,7 +1676,7 @@ static void on_btn_failed_cb(GtkButton *button)
clear_warnings();
update_ls_details_checkboxes(EMERGENCY_ANALYSIS_EVENT_NAME);
- setup_and_start_event_run(EMERGENCY_ANALYSIS_EVENT_NAME);
+ start_event_run(EMERGENCY_ANALYSIS_EVENT_NAME);
/* single shot button -> hide after click */
gtk_widget_hide(GTK_WIDGET(button));
@@ -1802,11 +1801,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
/* Hide spinner and stop btn */
gtk_widget_hide(GTK_WIDGET(g_spinner_event_log));
- if (retval != 0)
- gtk_widget_show(GTK_WIDGET(g_img_process_fail));
- else
- gtk_widget_show(GTK_WIDGET(g_img_process_ok));
-
gtk_widget_hide(g_btn_stop);
/* Enable (un-gray out) navigation buttons */
gtk_widget_set_sensitive(g_btn_close, true);
@@ -1817,9 +1811,10 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
if (retval != 0)
{
+ gtk_widget_show(GTK_WIDGET(g_img_process_fail));
/* 256 means NOT_REPORTABLE */
if (retval == 256)
- cancel_processing(g_lbl_event_log, evd->success_msg);
+ cancel_processing(g_lbl_event_log, _("Processing was interrupted because the problem is not reportable."));
else
{
/* We use SIGTERM to stop event processing on user's request.
@@ -1835,7 +1830,11 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
}
}
else
- gtk_label_set_text(g_lbl_event_log, evd->success_msg);
+ {
+ gtk_widget_show(GTK_WIDGET(g_img_process_ok));
+ gtk_label_set_text(g_lbl_event_log, is_processing_finished() ? _("Processing finished.")
+ : _("Processing finished, please proceed to the next step."));
+ }
/*g_source_remove(evd->event_source_id);*/
close(evd->fd);
@@ -1870,9 +1869,8 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
return TRUE; /* "please don't remove this event (yet)" */
}
-static void start_event_run(const char *event_name,
- const char *success_msg
-) {
+static void start_event_run(const char *event_name)
+{
/* Start event asynchronously on the dump dir
* (synchronous run would freeze GUI until completion)
*/
@@ -1927,7 +1925,6 @@ static void start_event_run(const char *event_name,
evd->run_state = state;
evd->event_name = xstrdup(event_name);
evd->env_list = env_list;
- evd->success_msg = success_msg;
evd->event_log = strbuf_new();
evd->fd = state->command_out_fd;
@@ -2262,15 +2259,6 @@ static void highlight_forbidden(void)
static gint select_next_page_no(gint current_page_no, gpointer data);
-static void setup_and_start_event_run(const char *event_name)
-{
- start_event_run(event_name,
- /* this event is the last event from the chain */
- is_processing_finished() ? _("Processing finished.")
- : _("Processing finished, please proceed to the next step.")
- );
-}
-
static char *get_next_processed_event(GList **events_list)
{
if (!events_list || !*events_list)
@@ -2445,7 +2433,7 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
&& g_event_selected[0]
) {
clear_warnings();
- setup_and_start_event_run(g_event_selected);
+ start_event_run(g_event_selected);
}
}
--
1.8.2.1
10 years, 12 months