[PATCH] run abrt oops log scanner as a separate service
by Denys Vlasenko
In preparation for
https://fedorahosted.org/abrt/ticket/189
"abrtd should reload configuration when some of it's config files changes"
I would like to stop running abrt-dump-oops as a child of abrtd.
We experimented with it: we made abrt-ccpp hook (de)installation
a separate service, and in my opinion it ended up a better
solution than making it a part of daemon. Among other reasons,
it makes abrt and abrt-addon-ccpp packages independent.
The patch below does the same for abrt-dump-oops.
Please take a look.
--
vda
diff -x '*.po' -d -urpN abrt.0/abrt-oops.init abrt.1/abrt-oops.init
--- abrt.0/abrt-oops.init 1970-01-01 01:00:00.000000000 +0100
+++ abrt.1/abrt-oops.init 2011-04-19 20:16:43.788884630 +0200
@@ -0,0 +1,97 @@
+#!/bin/bash
+# Start ABRT kernel log watcher
+#
+# chkconfig: 35 82 16
+# description: Watches system log for oops messages, creates ABRT dump directories for each oops
+### BEGIN INIT INFO
+# Provides: abrt-oops
+# Required-Start: $abrtd
+# Default-Stop: 0 1 2 6
+# Default-Start: 3 5
+# Short-Description: Watches system log for oops messages, creates ABRT dump directories for each oops
+# Description: Watches system log for oops messages, creates ABRT dump directories for each oops
+### END INIT INFO
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# For debugging
+dry_run=false
+verbose=false
+
+# We don't have pid files, therefore have to use
+# a flag file in /var/lock/subsys to enable GUI service tools
+# to figure out our status
+LOCK="/var/lock/subsys/abrt-oops"
+
+RETVAL=0
+
+check() {
+ # Check that we're a privileged user
+ [ "`id -u`" = 0 ] || exit 4
+}
+
+start() {
+ check
+ killall abrt-dump-oops 2>/dev/null
+ setsid abrt-dump-oops -d /var/spool/abrt -rwx /var/log/messages </dev/null >/dev/null 2>&1 &
+ $dry_run || touch -- "$LOCK"
+ return $RETVAL
+}
+
+stop() {
+ check
+ killall abrt-dump-oops
+ $dry_run || rm -f -- "$LOCK"
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ restart
+}
+
+case "$1" in
+start)
+ start
+ ;;
+stop)
+ stop
+ ;;
+reload)
+ reload
+ ;;
+force-reload)
+ echo "$0: Unimplemented feature."
+ RETVAL=3
+ ;;
+restart)
+ restart
+ ;;
+condrestart)
+ # Is it already running?
+ if test -f -- "$LOCK"; then # yes
+ $verbose && printf "Running, restarting\n"
+ restart
+ fi
+ ;;
+status)
+ # Is it already running?
+ if test -f -- "$LOCK"; then # yes
+ $verbose && printf "Running\n"
+ RETVAL=0
+ else
+ $verbose && printf "Not running\n"
+ RETVAL=3 # "stopped normally"
+ fi
+ ;;
+*)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
+ RETVAL=2
+esac
+
+exit $RETVAL
diff -x '*.po' -d -urpN abrt.0/abrt.spec abrt.1/abrt.spec
--- abrt.0/abrt.spec 2011-04-20 11:46:00.770641918 +0200
+++ abrt.1/abrt.spec 2011-04-19 20:03:43.764134592 +0200
@@ -29,6 +29,7 @@ URL: https://fedorahosted.org/abrt/
Source: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
Source1: abrt.init
Source2: abrt-ccpp.init
+Source3: abrt-oops.init
BuildRequires: dbus-devel
BuildRequires: gtk2-devel
BuildRequires: curl-devel
@@ -281,6 +282,7 @@ find $RPM_BUILD_ROOT -name '*.la' -or -n
mkdir -p ${RPM_BUILD_ROOT}/%{_initrddir}
install -m 755 %SOURCE1 ${RPM_BUILD_ROOT}/%{_initrddir}/abrtd
install -m 755 %SOURCE2 ${RPM_BUILD_ROOT}/%{_initrddir}/abrt-ccpp
+install -m 755 %SOURCE3 ${RPM_BUILD_ROOT}/%{_initrddir}/abrt-oops
mkdir -p $RPM_BUILD_ROOT/var/cache/abrt-di
mkdir -p $RPM_BUILD_ROOT/var/run/abrt
mkdir -p $RPM_BUILD_ROOT/var/spool/abrt
@@ -330,7 +332,13 @@ fi
# so 2.x fails when it tries to extract debuginfo there..
chown -R abrt:abrt %{_localstatedir}/cache/abrt-di
if [ $1 -eq 1 ]; then
-/sbin/chkconfig --add abrt-ccpp
+ /sbin/chkconfig --add abrt-ccpp
+fi
+#systemd: TODO
+
+%post addon-kerneloops
+if [ $1 -eq 1 ]; then
+ /sbin/chkconfig --add abrt-oops
fi
#systemd: TODO
@@ -340,27 +348,46 @@ fi
%preun
if [ "$1" -eq "0" ] ; then
- service abrtd stop >/dev/null 2>&1
- /sbin/chkconfig --del abrtd
+ service abrtd stop >/dev/null 2>&1
+ /sbin/chkconfig --del abrtd
fi
#systemd
%if %{?with_systemd}
if [ "$1" -eq "0" ] ; then
- /bin/systemctl stop abrtd.service >/dev/null 2>&1 || :
- /bin/systemctl disable abrtd.service >/dev/null 2>&1 || :
+ /bin/systemctl stop abrtd.service >/dev/null 2>&1 || :
+ /bin/systemctl disable abrtd.service >/dev/null 2>&1 || :
fi
%endif
%preun addon-ccpp
if [ "$1" -eq "0" ] ; then
- service abrt-ccpp stop >/dev/null 2>&1
- /sbin/chkconfig --del abrt-ccpp
+ service abrt-ccpp stop >/dev/null 2>&1
+ /sbin/chkconfig --del abrt-ccpp
fi
-#systemd: TODO
+#systemd (not tested):
+%if %{?with_systemd}
+if [ "$1" -eq "0" ] ; then
+ /bin/systemctl stop abrt-ccpp.service >/dev/null 2>&1 || :
+ /bin/systemctl disable abrt-ccpp.service >/dev/null 2>&1 || :
+fi
+%endif
+
+%preun addon-kerneloops
+if [ "$1" -eq "0" ] ; then
+ service abrt-oops stop >/dev/null 2>&1
+ /sbin/chkconfig --del abrt-oops
+fi
+#systemd (not tested):
+%if %{?with_systemd}
+if [ "$1" -eq "0" ] ; then
+ /bin/systemctl stop abrt-oops.service >/dev/null 2>&1 || :
+ /bin/systemctl disable abrt-oops.service >/dev/null 2>&1 || :
+fi
+%endif
%preun retrace-server
if [ "$1" = 0 ]; then
- /sbin/install-info --delete %{_infodir}/abrt-retrace-server %{_infodir}/dir 2> /dev/null || :
+ /sbin/install-info --delete %{_infodir}/abrt-retrace-server %{_infodir}/dir 2> /dev/null || :
fi
%postun
@@ -404,7 +431,23 @@ fi
if [ "$1" -eq "0" ]; then
service abrt-ccpp condrestart >/dev/null 2>&1 || :
fi
-#systemd: TODO
+#systemd
+%if %{?with_systemd}
+if [ "$1" -eq "0" ]; then
+ /bin/systemctl try-restart abrt-ccpp.service >/dev/null 2>&1 || :
+fi
+%endif
+
+%posttrans addon-kerneloops
+if [ "$1" -eq "0" ]; then
+ service abrt-oops condrestart >/dev/null 2>&1 || :
+fi
+#systemd
+%if %{?with_systemd}
+if [ "$1" -eq "0" ]; then
+ /bin/systemctl try-restart abrt-oops.service >/dev/null 2>&1 || :
+fi
+%endif
%files -f %{name}.lang
@@ -513,6 +556,7 @@ fi
%config(noreplace) %{_sysconfdir}/%{name}/plugins/Kerneloops.conf
%{_sysconfdir}/%{name}/events/report_Kerneloops.xml
%config(noreplace) %{_sysconfdir}/%{name}/events.d/koops_events.conf
+%{_initrddir}/abrt-oops
%{_mandir}/man7/abrt-KerneloopsReporter.7.gz
%{_bindir}/abrt-dump-oops
%{_bindir}/abrt-action-analyze-oops
diff -x '*.po' -d -urpN abrt.0/dbg_mkrpm abrt.1/dbg_mkrpm
--- abrt.0/dbg_mkrpm 2011-04-14 13:16:10.000000000 +0200
+++ abrt.1/dbg_mkrpm 2011-04-19 20:06:05.000000000 +0200
@@ -31,8 +31,7 @@ mkdir "$BUILDDIR" 2>/dev/null
(tar -czf - -C "$T" "abrt-$ABRTVER") >"$BUILDDIR"/"abrt-$ABRTVER".tar.gz
rm -rf "$T"
cp "$SRCDIR"/abrt.spec "$BUILDDIR"
-cp "$SRCDIR"/abrt.init "$BUILDDIR"
-cp "$SRCDIR"/abrt-ccpp.init "$BUILDDIR"
+cp "$SRCDIR"/abrt*.init "$BUILDDIR"
#cp "$SRCDIR"/dbg_* "$BUILDDIR" 2>/dev/null # developers' toys
{
diff -x '*.po' -d -urpN abrt.0/src/daemon/abrt.conf abrt.1/src/daemon/abrt.conf
--- abrt.0/src/daemon/abrt.conf 2011-04-14 13:16:10.000000000 +0200
+++ abrt.1/src/daemon/abrt.conf 2011-04-19 20:00:42.490885024 +0200
@@ -30,7 +30,7 @@ BlackListedPaths = /usr/share/doc/*,*/ex
MaxCrashReportsSize = 1000
-# So far we support only one line here
-#
-[ LogScanners ]
-abrt-dump-oops = abrt-dump-oops -d /var/spool/abrt -rwx /var/log/messages
+### # So far we support only one line here
+### #
+### [ LogScanners ]
+### abrt-dump-oops = abrt-dump-oops -d /var/spool/abrt -rwx /var/log/messages
13 years
ABRT 2.0 Coverity analysis
by Ondřej Vašík
Hi,
I checked ABRT-2.0 srpm by coverity, found defects are in attachement.
It is based on abrt-2.0.0-5.fc15 f15 build.
Greetings,
Ondrej Vasik
13 years
[PATCH] Fix rpm signature check (trac#198)
by Miroslav Lichvar
---
src/daemon/abrt-action-save-package-data.c | 2 +-
src/daemon/rpm.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/daemon/abrt-action-save-package-data.c b/src/daemon/abrt-action-save-package-data.c
index e58b425..7249551 100644
--- a/src/daemon/abrt-action-save-package-data.c
+++ b/src/daemon/abrt-action-save-package-data.c
@@ -198,7 +198,7 @@ static int SavePackageDescriptionToDebugDump(const char *dump_dir_name)
if (g_settings_bOpenGPGCheck && !remote)
{
- if (rpm_chk_fingerprint(package_short_name))
+ if (!rpm_chk_fingerprint(package_short_name))
{
log("Package '%s' isn't signed with proper key", package_short_name);
goto ret; /* return 1 (failure) */
diff --git a/src/daemon/rpm.c b/src/daemon/rpm.c
index 1295211..97b71e5 100644
--- a/src/daemon/rpm.c
+++ b/src/daemon/rpm.c
@@ -107,7 +107,7 @@ int rpm_chk_fingerprint(const char* pkg)
if (!header)
goto error;
- pgpsig = headerFormat(header, "%{SIGGPG:pgpsig}", &errmsg);
+ pgpsig = headerFormat(header, "%|SIGGPG?{%{SIGGPG:pgpsig}}:{%{SIGPGP:pgpsig}}|", &errmsg);
if (!pgpsig && errmsg)
{
VERB1 log("cannot get siggpg:pgpsig. reason: %s", errmsg);
@@ -119,7 +119,7 @@ int rpm_chk_fingerprint(const char* pkg)
if (pgpsig_tmp)
{
pgpsig_tmp += sizeof(" Key ID ") - 1;
- ret = (g_list_find(list_fingerprints, pgpsig_tmp) != NULL);
+ ret = g_list_find_custom(list_fingerprints, pgpsig_tmp, (GCompareFunc)g_strcmp0) != NULL;
}
}
--
1.7.4.4
13 years
How about renaming uuid to hash?
by Denys Vlasenko
We have uuid and global_uuid elements, and we don't use them as IDs.
I propose renaming them accordingly, to hash (or hash_local?)
and hash_global.
--
vda
13 years
[PATCH] wizard: show long description in tooltip for events
by Denys Vlasenko
The change is somewhat big because I can no longer (ab)use tooltip to store
event name. So I created a bit more generic method of remembering
which events are shown and selected.
--
vda
diff -x '*.po' -d -urpN abrt.0/src/gtk-helpers/autowrapped_label.c abrt.1/src/gtk-helpers/autowrapped_label.c
--- abrt.0/src/gtk-helpers/autowrapped_label.c 2011-04-14 15:42:25.000000000 +0200
+++ abrt.1/src/gtk-helpers/autowrapped_label.c 2011-04-14 20:08:16.195370453 +0200
@@ -62,6 +62,8 @@ void make_label_autowrap_on_resize(GtkLa
// So far, only tested to work on labels which were set up as:
//gtk_label_set_justify(label, GTK_JUSTIFY_LEFT);
//gtk_misc_set_alignment(GTK_MISC(label), /*xalign:*/ 0.0, /*yalign:*/ 0.0);
+ // yalign != 0 definitely breaks things!
+ // also, <property name="ypad">NONZERO</property> would be bad
/* Makes no sense on non-wrapped labels, so we can as well
* set wrapping to "on" unconditionally, istead of making it a requirement
diff -x '*.po' -d -urpN abrt.0/src/gui-wizard-gtk/wizard.c abrt.1/src/gui-wizard-gtk/wizard.c
--- abrt.0/src/gui-wizard-gtk/wizard.c 2011-04-14 15:42:25.000000000 +0200
+++ abrt.1/src/gui-wizard-gtk/wizard.c 2011-04-14 20:06:38.512620740 +0200
@@ -25,16 +25,30 @@
#define DEFAULT_WIDTH 800
#define DEFAULT_HEIGHT 500
+
+typedef struct event_gui_data_t
+{
+ char *event_name;
+ GtkToggleButton *toggle_button;
+} event_gui_data_t;
+
+
static GtkAssistant *g_assistant;
static char *g_analyze_event_selected;
static GtkBox *g_box_analyzers;
+/* List of event_gui_data's */
+static GList *g_list_analyzers;
static GtkLabel *g_lbl_analyze_log;
static GtkTextView *g_tv_analyze_log;
+
static GtkBox *g_box_reporters;
+/* List of event_gui_data's */
+static GList *g_list_reporters;
static GtkLabel *g_lbl_report_log;
static GtkTextView *g_tv_report_log;
+
static GtkContainer *g_container_details1;
static GtkContainer *g_container_details2;
@@ -150,7 +164,7 @@ static page_obj_t pages[] =
/* Utility functions */
-static void remove_child_widget(GtkWidget *widget, gpointer container)
+static void remove_child_widget(GtkWidget *widget, gpointer unused)
{
/* Destroy will safely remove it and free the memory
* if there are no refs left
@@ -292,6 +306,23 @@ static void append_to_textview(GtkTextVi
}
+/* event_gui_data_t */
+
+static event_gui_data_t *new_event_gui_data_t(void)
+{
+ return xzalloc(sizeof(event_gui_data_t));
+}
+
+static void free_event_gui_data_t(event_gui_data_t *evdata, void *unused)
+{
+ if (evdata)
+ {
+ free(evdata->event_name);
+ free(evdata);
+ }
+}
+
+
/* tv_details handling */
static void tv_details_row_activated(
@@ -362,40 +393,39 @@ static void tv_details_cursor_changed(
/* update_gui_state_from_crash_data */
+static gint find_by_button(gconstpointer a, gconstpointer button)
+{
+ const event_gui_data_t *evdata = a;
+ return (evdata->toggle_button != button);
+}
+
static void analyze_rb_was_toggled(GtkButton *button, gpointer user_data)
{
- const char *event_name = gtk_widget_get_tooltip_text(GTK_WIDGET(button));
- if (event_name)
+ GList *found = g_list_find_custom(g_list_analyzers, button, find_by_button);
+ if (found)
{
+ event_gui_data_t *evdata = found->data;
free(g_analyze_event_selected);
- g_analyze_event_selected = xstrdup(event_name);
+ g_analyze_event_selected = xstrdup(evdata->event_name);
}
}
static void report_tb_was_toggled(GtkButton *button_unused, gpointer user_data_unused)
{
struct strbuf *reporters_string = strbuf_new();
- GList *reporters = gtk_container_get_children(GTK_CONTAINER(g_box_reporters));
- GList *li = reporters;
- if (reporters)
+ GList *li = g_list_reporters;
+ for (; li; li = li->next)
{
- for (; li; li = li->next)
+ event_gui_data_t *event_gui_data = li->data;
+ if (gtk_toggle_button_get_active(event_gui_data->toggle_button) == TRUE)
{
- if (GTK_IS_TOGGLE_BUTTON(li->data))
- {
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
- {
- const char *event_name = gtk_widget_get_tooltip_text(GTK_WIDGET(li->data));
- strbuf_append_strf(reporters_string,
- "%s%s",
- (reporters_string->len != 0 ? ", " : ""),
- event_name
- );
- }
- }
+ strbuf_append_strf(reporters_string,
+ "%s%s",
+ (reporters_string->len != 0 ? ", " : ""),
+ event_gui_data->event_name
+ );
}
}
- g_list_free(reporters);
gtk_assistant_set_page_complete(g_assistant,
pages[PAGENO_REPORTER_SELECTOR].page_widget,
@@ -403,16 +433,33 @@ static void report_tb_was_toggled(GtkBut
);
/* Update "list of reporters" label */
- gtk_label_set_text(g_lbl_reporters, strbuf_free_nobuf(reporters_string));
+ char *str = strbuf_free_nobuf(reporters_string);
+ gtk_label_set_text(g_lbl_reporters, str);
+ free(str);
}
-static GtkWidget *add_event_buttons(GtkBox *box, char *event_name, GCallback func, bool radio, const char *prev_selected)
+/* event_name contains "EVENT1\nEVENT2\nEVENT3\n".
+ * Add new {radio/check}buttons to GtkBox for each EVENTn (type depends on bool radio).
+ * Remember them in GList **p_event_list (list of event_gui_data_t's).
+ * Set "toggled" callback on each button to given GCallback if it's not NULL.
+ * If prev_selected == EVENTn, set this button as active. In this case return NULL.
+ * Else return 1st button created (or NULL if none created).
+ */
+static event_gui_data_t *add_event_buttons(GtkBox *box,
+ GList **p_event_list,
+ char *event_name,
+ GCallback func,
+ bool radio,
+ const char *prev_selected)
{
//VERB2 log("removing all buttons from box %p", box);
- gtk_container_foreach(GTK_CONTAINER(box), &remove_child_widget, box);
+ gtk_container_foreach(GTK_CONTAINER(box), &remove_child_widget, NULL);
+ g_list_foreach(*p_event_list, (GFunc)free_event_gui_data_t, NULL);
+ g_list_free(*p_event_list);
+ *p_event_list = NULL;
bool have_activated_btn = false;
- GtkWidget *first_button = NULL;
+ event_gui_data_t *first_button = NULL;
while (event_name[0])
{
char *event_name_end = strchr(event_name, '\n');
@@ -434,21 +481,32 @@ static GtkWidget *add_event_buttons(GtkB
event_screen_name = cfg->screen_name;
event_description = cfg->description;
}
+
+ //VERB2 log("adding button '%s' to box %p", event_name, box);
char *event_label = xasprintf("%s%s%s",
event_screen_name,
(event_description ? " - " : ""),
event_description ? event_description : ""
);
-
- //VERB2 log("adding button '%s' to box %p", event_name, box);
GtkWidget *button = radio
- ? gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(first_button), event_label)
+ ? gtk_radio_button_new_with_label_from_widget(
+ (first_button ? GTK_RADIO_BUTTON(first_button->toggle_button) : NULL),
+ event_label
+ )
: gtk_check_button_new_with_label(event_label);
- if (!first_button)
- first_button = button;
free(event_label);
- /* Important: tooltip isn't used merely as decoration. We retrieve event name in the toggle handlers! */
- gtk_widget_set_tooltip_text(button, event_name);
+ if (func)
+ g_signal_connect(G_OBJECT(button), "toggled", func, NULL);
+ if (cfg->long_descr)
+ gtk_widget_set_tooltip_text(button, cfg->long_descr);
+
+ event_gui_data_t *event_gui_data = new_event_gui_data_t();
+ event_gui_data->event_name = xstrdup(event_name);
+ event_gui_data->toggle_button = GTK_TOGGLE_BUTTON(button);
+ *p_event_list = g_list_append(*p_event_list, event_gui_data);
+
+ if (!first_button)
+ first_button = event_gui_data;
if (prev_selected && strcmp(prev_selected, event_name) == 0)
{
@@ -462,8 +520,6 @@ static GtkWidget *add_event_buttons(GtkB
gtk_box_pack_start(box, button, /*expand*/ false, /*fill*/ false, /*padding*/ 0);
- if (func)
- g_signal_connect(G_OBJECT(button), "toggled", func, NULL);
}
return (have_activated_btn ? NULL : first_button);
}
@@ -527,6 +583,7 @@ void update_gui_state_from_crash_data(vo
const char *reason = get_crash_item_content_or_NULL(g_cd, FILENAME_REASON);
gtk_label_set_text(g_lbl_cd_reason, reason ? reason : _("(no description)"));
+///vda make_label_autowrap_on_resize(g_lbl_cd_reason);
gtk_list_store_clear(g_ls_details);
struct cd_stats stats = { 0 };
@@ -539,56 +596,50 @@ void update_gui_state_from_crash_data(vo
load_text_to_text_view(g_tv_comment, FILENAME_COMMENT);
/* Update analyze radio buttons */
- GtkWidget *first_rb = add_event_buttons(g_box_analyzers, g_analyze_events, G_CALLBACK(analyze_rb_was_toggled), /*radio:*/ true, /*prev:*/ g_analyze_event_selected);
+ event_gui_data_t *first_rb = add_event_buttons(g_box_analyzers, &g_list_analyzers,
+ g_analyze_events, G_CALLBACK(analyze_rb_was_toggled),
+ /*radio:*/ true, /*prev:*/ g_analyze_event_selected
+ );
/* Update the value of currently selected analyzer */
if (first_rb)
{
- const char *event_name = gtk_widget_get_tooltip_text(first_rb);
- if (event_name)
- {
- free(g_analyze_event_selected);
- g_analyze_event_selected = xstrdup(event_name);
- }
+ free(g_analyze_event_selected);
+ g_analyze_event_selected = xstrdup(first_rb->event_name);
}
/* Update reporter checkboxes */
/* Remember names of selected reporters */
- GList *old_reporters = gtk_container_get_children(GTK_CONTAINER(g_box_reporters));
- GList *li;
- for (li = old_reporters; li; li = li->next)
+ GList *old_reporters = NULL;
+ GList *li = g_list_reporters;
+ for (; li; li = li->next)
{
- if (GTK_IS_TOGGLE_BUTTON(li->data))
+ event_gui_data_t *event_gui_data = li->data;
+ if (gtk_toggle_button_get_active(event_gui_data->toggle_button) == TRUE)
{
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
- li->data = xstrdup(gtk_button_get_label(GTK_BUTTON(li->data)));
+ /* order isn't important. prepend is faster */
+ old_reporters = g_list_prepend(old_reporters, xstrdup(event_gui_data->event_name));
}
- else
- li->data = NULL;
}
- old_reporters = g_list_remove_all(old_reporters, NULL);
/* Delete old checkboxes and create new ones */
- add_event_buttons(g_box_reporters, g_report_events, /*callback:*/ G_CALLBACK(report_tb_was_toggled), /*radio:*/ false, /*prev:*/ NULL);
+ add_event_buttons(g_box_reporters, &g_list_reporters,
+ g_report_events, /*callback:*/ G_CALLBACK(report_tb_was_toggled),
+ /*radio:*/ false, /*prev:*/ NULL
+ );
/* Re-select new reporters which were selected before we deleted them */
- GList *new_reporters = gtk_container_get_children(GTK_CONTAINER(g_box_reporters));
- GList *li_new;
- for (li_new = new_reporters; li_new; li_new = li_new->next)
+ GList *li_new = g_list_reporters;
+ for (; li_new; li_new = li_new->next)
{
- if (GTK_IS_TOGGLE_BUTTON(li_new->data))
+ event_gui_data_t *new_gui_data = li_new->data;
+ GList *li_old = old_reporters;
+ for (; li_old; li_old = li_old->next)
{
- const char *new_name = gtk_button_get_label(GTK_BUTTON(li_new->data));
- GList *li_old;
-
- for (li_old = old_reporters; li_old; li_old = li_old->next)
+ if (strcmp(new_gui_data->event_name, li_old->data) == 0)
{
- if (strcmp(new_name, li_old->data) == 0)
- {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(li_new->data), true);
- break;
- }
+ gtk_toggle_button_set_active(new_gui_data->toggle_button, true);
+ break;
}
}
}
- g_list_free(new_reporters);
list_free_with_free(old_reporters);
/* Update readiness state of reporter selector page and "list of reporters" label */
@@ -1026,36 +1077,29 @@ static void next_page(GtkAssistant *assi
if (page_no == PAGENO_REPORT)
{
- GList *reporters = gtk_container_get_children(GTK_CONTAINER(g_box_reporters));
- if (reporters)
+ GList *reporters = NULL;
+ GList *li = g_list_reporters;
+ for (; li; li = li->next)
{
- GList *li;
- for (li = reporters; li; li = li->next)
- {
- if (GTK_IS_TOGGLE_BUTTON(li->data))
- {
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(li->data)) == TRUE)
- /* Button's tooltip contains event_name */
- li->data = (gpointer)gtk_widget_get_tooltip_text(GTK_WIDGET(li->data));
- }
- else
- li->data = NULL;
- }
- reporters = g_list_remove_all(reporters, NULL);
- if (reporters)
+ event_gui_data_t *event_gui_data = li->data;
+ if (gtk_toggle_button_get_active(event_gui_data->toggle_button) == TRUE)
{
- char *first_event_name = reporters->data;
- reporters = g_list_remove(reporters, reporters->data);
- start_event_run(first_event_name,
- reporters,
- pages[PAGENO_REPORT_PROGRESS].page_widget,
- g_tv_report_log,
- g_lbl_report_log,
- _("Reporting..."),
- _("Reporting finished with exit code %d")
- );
+ reporters = g_list_append(reporters, event_gui_data->event_name);
}
}
+ if (reporters)
+ {
+ char *first_event_name = reporters->data;
+ reporters = g_list_remove(reporters, reporters->data);
+ start_event_run(first_event_name,
+ reporters,
+ pages[PAGENO_REPORT_PROGRESS].page_widget,
+ g_tv_report_log,
+ g_lbl_report_log,
+ _("Reporting..."),
+ _("Reporting finished with exit code %d")
+ );
+ }
}
}
@@ -1264,6 +1308,7 @@ static void add_pages(void)
g_lbl_reporters = GTK_LABEL( gtk_builder_get_object(builder, "lbl_reporters"));
g_lbl_size = GTK_LABEL( gtk_builder_get_object(builder, "lbl_size"));
+ make_label_autowrap_on_resize(g_lbl_cd_reason);
gtk_widget_modify_font(GTK_WIDGET(g_tv_analyze_log), monospace_font);
gtk_widget_modify_font(GTK_WIDGET(g_tv_report_log), monospace_font);
gtk_widget_modify_font(GTK_WIDGET(g_tv_backtrace), monospace_font);
diff -x '*.po' -d -urpN abrt.0/src/gui-wizard-gtk/wizard.glade abrt.1/src/gui-wizard-gtk/wizard.glade
--- abrt.0/src/gui-wizard-gtk/wizard.glade 2011-04-14 16:00:41.000000000 +0200
+++ abrt.1/src/gui-wizard-gtk/wizard.glade 2011-04-14 20:03:34.740517564 +0200
@@ -7,12 +7,14 @@
<object class="GtkVBox" id="page_0">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="border_width">3</property>
+ <property name="spacing">3</property>
<child>
<object class="GtkLabel" id="lbl_cd_reason">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="ypad">5</property>
+ <property name="yalign">0</property>
<property name="wrap">True</property>
<attributes>
<attribute name="style" value="normal"/>
diff -x '*.po' -d -urpN abrt.0/src/include/report/event_config.h abrt.1/src/include/report/event_config.h
--- abrt.0/src/include/report/event_config.h 2011-04-14 13:16:10.000000000 +0200
+++ abrt.1/src/include/report/event_config.h 2011-04-14 16:54:11.439366726 +0200
@@ -64,10 +64,11 @@ void free_event_option(event_option_t *p
//structure to hold the option data
typedef struct
{
- char *screen_name; //ui friendly name of the event "Bugzilla" "RedHat Support Uploader"
- //char *title; //window title - not used right now, maybe the "name" is enough?
- //char *action;//action description to show in gui like: Upload report to the Red Hat bugzilla"
- char *description; // "Report to ...."/"Save to file"
+ char *screen_name; //ui friendly name of the event: "Bugzilla" "RedHat Support Upload"
+ //char *title; //window title - not used right now, maybe the "name" is enough?
+ //char *action; //action description to show in gui like: Upload report to the Red Hat bugzilla"
+ char *description; // "Report to..."/"Save to file". Should be one sentence, not long
+ char *long_descr; // Long(er) explanation, if needed
GList *options;
} event_config_t;
diff -x '*.po' -d -urpN abrt.0/src/lib/event_config.c abrt.1/src/lib/event_config.c
--- abrt.0/src/lib/event_config.c 2011-04-14 13:16:10.000000000 +0200
+++ abrt.1/src/lib/event_config.c 2011-04-14 16:55:04.721116553 +0200
@@ -53,6 +53,7 @@ void free_event_config(event_config_t *p
//free(p->title);
//free(p->action);
free(p->description);
+ free(p->long_descr);
for (opt = p->options; opt; opt = opt->next)
free_event_option(opt->data);
g_list_free(p->options);
diff -x '*.po' -d -urpN abrt.0/src/lib/event_xml_parser.c abrt.1/src/lib/event_xml_parser.c
--- abrt.0/src/lib/event_xml_parser.c 2011-04-14 13:16:10.000000000 +0200
+++ abrt.1/src/lib/event_xml_parser.c 2011-04-14 19:45:13.143769677 +0200
@@ -22,6 +22,7 @@
#define EVENT_ELEMENT "event"
#define LABEL_ELEMENT "label"
#define DESCRIPTION_ELEMENT "description"
+#define LONG_DESCR_ELEMENT "long_description"
#define ALLOW_EMPTY_ELEMENT "allow-empty"
#define OPTION_ELEMENT "option"
//#define ACTION_ELEMENT "action"
@@ -172,13 +173,11 @@ static void start_element(GMarkupParseCo
}
}
}
- else if (strcmp(element_name, LABEL_ELEMENT) == 0)
- {
- free(parse_data->attribute_lang);
- parse_data->attribute_lang = get_element_lang(parse_data, attribute_names, attribute_values);
- }
- else if (strcmp(element_name, DESCRIPTION_ELEMENT) == 0)
- {
+ else
+ if (strcmp(element_name, LABEL_ELEMENT) == 0
+ || strcmp(element_name, DESCRIPTION_ELEMENT) == 0
+ || strcmp(element_name, LONG_DESCR_ELEMENT) == 0
+ ) {
free(parse_data->attribute_lang);
parse_data->attribute_lang = get_element_lang(parse_data, attribute_names, attribute_values);
}
@@ -305,6 +304,24 @@ static void text(GMarkupParseContext *co
}
return;
}
+ if (strcmp(inner_element, LONG_DESCR_ELEMENT) == 0)
+ {
+ VERB2 log("event long description:'%s'", text_copy);
+
+ if (parse_data->attribute_lang != NULL) /* if it isn't for other locale */
+ {
+ /* set the value only if we found a value for the current locale
+ * OR the description is still not set and we found the default value
+ */
+ if (parse_data->attribute_lang[0] != '\0'
+ || !ui->long_descr /* && parse_data->attribute_lang is "" - always true */
+ ) {
+ free(ui->long_descr);
+ ui->long_descr = text_copy;
+ }
+ }
+ return;
+ }
}
free(text_copy);
}
diff -x '*.po' -d -urpN abrt.0/src/plugins/analyze_LocalGDB.xml.in abrt.1/src/plugins/analyze_LocalGDB.xml.in
--- abrt.0/src/plugins/analyze_LocalGDB.xml.in 2011-04-14 13:16:10.000000000 +0200
+++ abrt.1/src/plugins/analyze_LocalGDB.xml.in 2011-04-14 20:24:06.109740247 +0200
@@ -2,4 +2,7 @@
<event>
<_name>Local GNU Debugger</_name>
<_description>Download debuginfo packages and generate backtrace locally using GDB</_description>
+ <_long_description>Needs to downloads debuginfo packages, which might take significant time, and take up disk space.
+ However, unlike RetraceServer, doesn't send coredump to remote machines.
+ </_long_description>
</event>
diff -x '*.po' -d -urpN abrt.0/src/plugins/analyze_RetraceServer.xml.in abrt.1/src/plugins/analyze_RetraceServer.xml.in
--- abrt.0/src/plugins/analyze_RetraceServer.xml.in 2011-04-14 13:16:10.000000000 +0200
+++ abrt.1/src/plugins/analyze_RetraceServer.xml.in 2011-04-14 20:16:35.209989417 +0200
@@ -2,6 +2,10 @@
<event>
<name>Retrace Server</name>
<_description>Send core dump to remote retrace server for analysis</_description>
+ <_long_description>Uploads coredump to a server, which generates backtrace and returns it.
+ Pros: no need for debuginfo downloads. Retrace server's database of debuginfos is more complete. Retrace server may generate better backtraces.
+ Cons: coredump you upload contains all the data from the crashed program, including your private data, if any.
+ </_long_description>
<options>
<option type="text" name="RETRACE_SERVER_URL">
<_label>Retrace server URL</_label>
13 years
[PATCH] split abrt-action-debuginfo-install.py in two
by Jiri Moskovcak
split abrt-action-install-debuginfo into two apps rhbz#692064
- the first part analyzes the coredump and writes the required
build-ids into a file (by default "build_ids")
- the second app reads the file and tries to find the debuginfo
packages for build-ids
run tested, please review.
13 years
[PATCH] convert abrt-cli to generic element handling
by Denys Vlasenko
abrt-cli is one of several places where we hardcode usage of various
elements of dump directory.
This patch changes it to generic handling, where abrt-cli doesn't know
anything about particular elements (like backtrace).
Changes in detail:
* crash_item->flags how has CD_FLAG_UNIXTIME bit.
* format_crash_item(item) returns malloced formatted string
(currently only formatted time for items with CD_FLAG_UNIXTIME)
or NULL, if item->content is to be used as-is
* crash_item->flags how has CD_FLAG_LIST bit, it is set on a
small number of elements which are to be shown by abrt-cli -l.
* abrt-cli -l doesn't use fixed names, it looks at CD_FLAG_LIST.
* abrt-cli -i doesn't use fixed names, it prints all one-line elements:
# abrt-cli -i /var/spool/abrt/ccpp-1298264192-2705
Directory : /var/spool/abrt/ccpp-1298264192-2705
analyzer : CCpp
architecture : x86_64
cmdline : metacity
comment : Abrt testing, please disregard
component : metacity
coredump : /var/spool/abrt/ccpp-1298264192-2705/coredump
count : 1
crash_function : pa_atomic_load
executable : /usr/bin/metacity
global_uuid : 1e8b716d2094fb22dccdb5321ac0cf6f14eb6689
hostname : dhcp-25-227.brq.redhat.com
kernel : 2.6.34.7-61.fc13.x86_64
os_release : Fedora release 13 (Goddard)
package : metacity-2.30.0-3.fc13
rating : 4
reason : Process /usr/bin/metacity was killed by signal 11 (SIGSEGV)
time : Mon 21 Feb 2011 05:56:32 AM CET
uid : 500
uuid : 453085d0f703b96ddc3a5172dd7d5a29479f5b3f
* abrt-cli -i --backtrace is removed. Instead, abrt-cli -i --full
is to be used. It shows all elements, one-line and multi-line ones.
* abrt-cli code now has an example how to list crast_data_t
in the sorted-by-key order.
Further ideas:
abrt-cli needs -o elem1,elem2,elem3 option which tells which elements to
show, and/or -O elem1,elem2,elem3 option which tells elements to NOT
show. Rationale: abrt-cli -i --full output is way too long because of
smaps, need a way to suppress unneeded elements display
Please review.
--
vda
diff -x '*.po' -d -urpN abrt.0/src/cli/cli.c abrt.1/src/cli/cli.c
--- abrt.0/src/cli/cli.c 2011-04-04 19:47:09.000000000 +0200
+++ abrt.1/src/cli/cli.c 2011-04-08 11:54:09.261919919 +0200
@@ -23,17 +23,6 @@
#include "abrt_dbus.h"
#include "report.h"
-/** Creates a localized string from crash time. */
-static char *localize_crash_time(const char *timestr)
-{
- long time = xatou(timestr);
- char timeloc[256];
- int success = strftime(timeloc, sizeof(timeloc), "%c", localtime(&time));
- if (!success)
- error_msg_and_die("Error while converting time '%s' to string", timestr);
- return xstrdup(timeloc);
-}
-
static crash_data_t *FillCrashInfo(const char *dump_dir_name)
{
int sv_logmode = logmode;
@@ -83,30 +72,24 @@ static void GetCrashInfos(vector_of_cras
/** Prints basic information about a crash to stdout. */
static void print_crash(crash_data_t *crash_data)
{
- /* Create a localized string from crash time. */
- const char *timestr = get_crash_item_content_or_die(crash_data, FILENAME_TIME);
- char *timeloc = localize_crash_time(timestr);
-
- printf(_("\tCrash dump : %s\n"
- "\tUID : %s\n"
- "\tPackage : %s\n"
- "\tExecutable : %s\n"
- "\tCrash Time : %s\n"
- "\tCrash Count: %s\n"),
- get_crash_item_content_or_NULL(crash_data, CD_DUMPDIR),
- get_crash_item_content_or_NULL(crash_data, FILENAME_UID),
- get_crash_item_content_or_NULL(crash_data, FILENAME_PACKAGE),
- get_crash_item_content_or_NULL(crash_data, FILENAME_EXECUTABLE),
- timeloc,
- get_crash_item_content_or_NULL(crash_data, FILENAME_COUNT)
- );
-
- free(timeloc);
-
- /* Print the hostname if it's available. */
- const char *hostname = get_crash_item_content_or_NULL(crash_data, FILENAME_HOSTNAME);
- if (hostname)
- printf(_("\tHostname : %s\n"), hostname);
+ struct crash_item *item = g_hash_table_lookup(crash_data, CD_DUMPDIR);
+ if (item)
+ printf("\tDirectory : %s\n", item->content);
+ GList *list = g_hash_table_get_keys(crash_data);
+ GList *l = list = g_list_sort(list, (GCompareFunc)strcmp);
+ while (l)
+ {
+ const char *key = l->data;
+ item = g_hash_table_lookup(crash_data, key);
+ if (item && (item->flags & CD_FLAG_LIST) && !strchr(item->content, '\n'))
+ {
+ char *formatted = format_crash_item(item);
+ printf("\t%-12s: %s\n", key, formatted ? formatted : item->content);
+ free(formatted);
+ }
+ l = l->next;
+ }
+ g_list_free(list);
}
/**
@@ -135,64 +118,42 @@ static void print_crash_list(vector_of_c
/**
* Prints full information about a crash
*/
-static void print_crash_info(crash_data_t *crash_data, bool show_backtrace)
+static void print_crash_info(crash_data_t *crash_data, bool show_multiline)
{
- const char *timestr = get_crash_item_content_or_die(crash_data, FILENAME_TIME);
- char *timeloc = localize_crash_time(timestr);
-
- printf(_("Dump directory: %s\n"
- "Last crash: %s\n"
- "Analyzer: %s\n"
- "Component: %s\n"
- "Package: %s\n"
- "Command: %s\n"
- "Executable: %s\n"
- "System: %s, kernel %s\n"
- "Reason: %s\n"),
- get_crash_item_content_or_die(crash_data, CD_DUMPDIR),
- timeloc,
- get_crash_item_content_or_die(crash_data, FILENAME_ANALYZER),
- get_crash_item_content_or_die(crash_data, FILENAME_COMPONENT),
- get_crash_item_content_or_die(crash_data, FILENAME_PACKAGE),
- get_crash_item_content_or_die(crash_data, FILENAME_CMDLINE),
- get_crash_item_content_or_die(crash_data, FILENAME_EXECUTABLE),
- get_crash_item_content_or_die(crash_data, FILENAME_OS_RELEASE),
- get_crash_item_content_or_die(crash_data, FILENAME_KERNEL),
- get_crash_item_content_or_die(crash_data, FILENAME_REASON)
- );
-
- free(timeloc);
-
- /* Print optional fields only if they are available */
-
- /* Coredump is not present in kerneloopses and Python exceptions. */
- const char *coredump = get_crash_item_content_or_NULL(crash_data, FILENAME_COREDUMP);
- if (coredump)
- printf(_("Coredump file: %s\n"), coredump);
-
- const char *rating = get_crash_item_content_or_NULL(crash_data, FILENAME_RATING);
- if (rating)
- printf(_("Rating: %s\n"), rating);
-
- /* Crash function is not present in kerneloopses, and before the full report is created.*/
- const char *crash_function = get_crash_item_content_or_NULL(crash_data, FILENAME_CRASH_FUNCTION);
- if (crash_function)
- printf(_("Crash function: %s\n"), crash_function);
-
- const char *hostname = get_crash_item_content_or_NULL(crash_data, FILENAME_HOSTNAME);
- if (hostname)
- printf(_("Hostname: %s\n"), hostname);
-
- const char *comment = get_crash_item_content_or_NULL(crash_data, FILENAME_COMMENT);
- if (comment)
- printf(_("\nComment:\n%s\n"), comment);
+ struct crash_item *item = g_hash_table_lookup(crash_data, CD_DUMPDIR);
+ if (item)
+ printf("%-16s: %s\n", "Directory", item->content);
- if (show_backtrace)
+ GList *list = g_hash_table_get_keys(crash_data);
+ GList *l = list = g_list_sort(list, (GCompareFunc)strcmp);
+ bool multi_line = 0;
+ while (l)
{
- const char *backtrace = get_crash_item_content_or_NULL(crash_data, FILENAME_BACKTRACE);
- if (backtrace)
- printf(_("\nBacktrace:\n%s\n"), backtrace);
+ const char *key = l->data;
+ if (strcmp(key, CD_DUMPDIR) != 0)
+ {
+ item = g_hash_table_lookup(crash_data, key);
+ if (item)
+ {
+ char *formatted = format_crash_item(item);
+ char *output = formatted ? formatted : item->content;
+ char *last_eol = strrchr(output, '\n');
+ if (show_multiline || !last_eol)
+ {
+ /* prev value was multi-line, or this value is multi-line? */
+ if (multi_line || last_eol)
+ printf("\n");
+ printf("%-16s:%c%s", key, (last_eol ? '\n' : ' '), output);
+ if (!last_eol || last_eol[1] != '\0')
+ printf("\n"); /* go to next line only if necessary */
+ multi_line = (last_eol != NULL);
+ }
+ free(formatted);
+ }
+ }
+ l = l->next;
}
+ g_list_free(list);
}
/* Program options */
@@ -224,7 +185,6 @@ static const struct option longopts[] =
{ "report" , no_argument, NULL, 'r' },
{ "delete" , no_argument, NULL, 'd' },
{ "info" , no_argument, NULL, 'i' },
- { "backtrace", no_argument, NULL, 'b' },
{ 0, 0, 0, 0 } /* prevents crashes for unknown options*/
};
@@ -253,15 +213,17 @@ static void print_usage_and_die(char *ar
" or: %s -i[b] CRASH_DIR\n"
" or: %s -d CRASH_DIR\n"
"\n"
- " -l, --list List not yet reported crashes\n"
- " -f, --full List all crashes\n"
- " -D BASE_DIR Directory to list crashes from\n"
+ " -l, --list List not yet reported problems\n"
+ " -f, --full List all problems\n"
+ " -D BASE_DIR Directory to list problems from\n"
" (default: -D $HOME/.abrt/spool -D %s)\n"
"\n"
" -r, --report Send a report about CRASH_DIR\n"
" -y, --always ...without editing and asking\n"
" -i, --info Print detailed information about CRASH_DIR\n"
- " -b, --backtrace ...including backtrace\n"
+ " -f, --full ...including multi-line entries\n"
+ " Note: -if will run analyzers\n"
+ " (if this CRASH_DIR have defined analyzers)\n"
" -d, --delete Remove CRASH_DIR\n"
"\n"
" -V, --version Display version and exit\n"
@@ -280,7 +242,6 @@ int main(int argc, char** argv)
int op = -1;
bool full = false;
bool always = false;
- bool backtrace = false;
setlocale(LC_ALL, "");
#if ENABLE_NLS
@@ -309,7 +270,6 @@ int main(int argc, char** argv)
case 'i': SET_OP(OPT_INFO); break;
case 'f': full = true; break;
case 'y': always = true; break;
- case 'b': backtrace = true; break;
case 'v': g_verbose++; break;
case 'D':
D_list = g_list_append(D_list, optarg);
@@ -353,10 +313,7 @@ int main(int argc, char** argv)
/* Check if we have an operation.
* Limit --full and --always to certain operations.
*/
- if ((full && op != OPT_GET_LIST) ||
- (always && op != OPT_REPORT) ||
- (backtrace && op != OPT_INFO) ||
- op == -1)
+ if ((always && op != OPT_REPORT) || op == -1)
{
print_usage_and_die(argv[0]);
}
@@ -420,7 +377,7 @@ int main(int argc, char** argv)
char *analyze_events_as_lines = list_possible_events(dd, NULL, "analyze");
- if (backtrace && analyze_events_as_lines && *analyze_events_as_lines)
+ if (full && analyze_events_as_lines && *analyze_events_as_lines)
{
dd_close(dd);
@@ -449,7 +406,7 @@ int main(int argc, char** argv)
add_to_crash_data_ext(crash_data, CD_DUMPDIR, dump_dir_name,
CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE);
- print_crash_info(crash_data, backtrace);
+ print_crash_info(crash_data, full);
free_crash_data(crash_data);
break;
diff -x '*.po' -d -urpN abrt.0/src/gui-wizard-gtk/wizard.c abrt.1/src/gui-wizard-gtk/wizard.c
--- abrt.0/src/gui-wizard-gtk/wizard.c 2011-03-30 14:09:56.000000000 +0200
+++ abrt.1/src/gui-wizard-gtk/wizard.c 2011-04-08 10:45:05.901669935 +0200
@@ -311,7 +311,7 @@ static void tv_details_row_activated(
struct crash_item *item = get_crash_data_item_or_NULL(g_cd, column_name);
if (!item || !(item->flags & CD_FLAG_TXT))
return;
- if (item->flags & CD_FLAG_ONELINE)
+ if (!strchr(item->content, '\n')) /* one line? */
return;
gchar *arg[3];
@@ -346,7 +346,7 @@ static void tv_details_cursor_changed(
gtk_tree_model_get(model, &iter, DETAIL_COLUMN_NAME, &column_name, -1);
struct crash_item *item = get_crash_data_item_or_NULL(g_cd, column_name);
- gboolean editable = (item && (item->flags & (CD_FLAG_TXT|CD_FLAG_ONELINE)) == (CD_FLAG_TXT|CD_FLAG_ONELINE));
+ gboolean editable = (item && (item->flags & CD_FLAG_TXT) && !strchr(item->content, '\n'));
/* Allow user to select the text with mouse.
* Has undesirable side-effect of allowing user to "edit" the text,
diff -x '*.po' -d -urpN abrt.0/src/include/report/crash_data.h abrt.1/src/include/report/crash_data.h
--- abrt.0/src/include/report/crash_data.h 2011-03-24 23:34:47.000000000 +0100
+++ abrt.1/src/include/report/crash_data.h 2011-04-08 11:10:39.261669847 +0200
@@ -32,7 +32,9 @@ enum {
CD_FLAG_TXT = (1 << 1),
CD_FLAG_ISEDITABLE = (1 << 2),
CD_FLAG_ISNOTEDITABLE = (1 << 3),
- CD_FLAG_ONELINE = (1 << 4),
+ /* Show this element in "short" info (abrt-cli -l) */
+ CD_FLAG_LIST = (1 << 4),
+ CD_FLAG_UNIXTIME = (1 << 5),
};
struct crash_item {
@@ -41,6 +43,8 @@ struct crash_item {
};
typedef struct crash_item crash_item;
+char *format_crash_item(struct crash_item *item);
+
/* In-memory crash data structure and accessors */
typedef GHashTable crash_data_t;
diff -x '*.po' -d -urpN abrt.0/src/lib/crash_data.c abrt.1/src/lib/crash_data.c
--- abrt.0/src/lib/crash_data.c 2011-03-24 23:34:47.000000000 +0100
+++ abrt.1/src/lib/crash_data.c 2011-04-08 11:57:23.521679669 +0200
@@ -28,6 +28,26 @@ static void free_crash_item(void *ptr)
}
}
+char *format_crash_item(struct crash_item *item)
+{
+ if (!item)
+ return xstrdup("(nullitem)");
+
+ if (item->flags & CD_FLAG_UNIXTIME)
+ {
+ errno = 0;
+ char *end;
+ time_t time = strtol(item->content, &end, 10);
+ if (!errno && !*end && end != item->content)
+ {
+ char timeloc[256];
+ int success = strftime(timeloc, sizeof(timeloc), "%c", localtime(&time));
+ if (success)
+ return xstrdup(timeloc);
+ }
+ }
+ return NULL;
+}
/* crash_data["name"] = { "content", CD_FLAG_foo_bits } */
@@ -43,11 +63,7 @@ void add_to_crash_data_ext(crash_data_t
unsigned flags)
{
if (!(flags & CD_FLAG_BIN))
- {
flags |= CD_FLAG_TXT;
- if (!strchr(content, '\n'))
- flags |= CD_FLAG_ONELINE;
- }
if (!(flags & CD_FLAG_ISEDITABLE))
flags |= CD_FLAG_ISNOTEDITABLE;
@@ -244,9 +260,19 @@ void load_crash_data_from_dump_dir(crash
else
flags |= CD_FLAG_TXT | CD_FLAG_ISNOTEDITABLE;
- int oneline = strchr(content, '\n') == NULL;
- if (oneline)
- flags |= CD_FLAG_ONELINE;
+ static const char *const list_files[] = {
+ FILENAME_UID ,
+ FILENAME_PACKAGE ,
+ FILENAME_EXECUTABLE,
+ FILENAME_TIME ,
+ FILENAME_COUNT ,
+ NULL
+ };
+ if (is_in_list(short_name, list_files))
+ flags |= CD_FLAG_LIST;
+
+ if (strcmp(short_name, FILENAME_TIME) == 0)
+ flags |= CD_FLAG_UNIXTIME;
add_to_crash_data_ext(crash_data,
short_name,
13 years
[PATCH] do not forget settings everytime when you run start_event_run()
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/gui-wizard-gtk/main.c | 5 +++++
src/gui-wizard-gtk/wizard.c | 5 -----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/gui-wizard-gtk/main.c b/src/gui-wizard-gtk/main.c
index 2914b30..87159ae 100644
--- a/src/gui-wizard-gtk/main.c
+++ b/src/gui-wizard-gtk/main.c
@@ -110,6 +110,11 @@ int main(int argc, char **argv)
g_dump_dir_name = xstrdup(argv[0]);
+ /* load /etc/abrt/events/foo.{conf,xml} stuff
+ and ~/.abrt/events/foo.conf */
+ load_event_config_data();
+ load_event_config_data_from_keyring();
+
create_assistant();
g_custom_logger = &show_error_as_msgbox;
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index f23be58..fec8eb3 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -861,11 +861,6 @@ static void start_event_run(const char *event_name,
if (!locked)
return; /* user refused to steal, or write error, etc... */
- /* Load /etc/abrt/events/foo.{conf,xml} stuff */
- load_event_config_data();
- load_event_config_data_from_keyring();
- //TODO: Load ~/.abrt/events/foo.conf?
-
GList *env_list = export_event_config(event_name);
if (spawn_next_command(state, g_dump_dir_name, event_name) < 0)
{
--
1.7.1
13 years
[PATCH] cli: reimplement rating-required for bugzilla
by Nikola Pajkovsky
is there any other plugin which using this?
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/cli/report.c | 11 ++++-------
src/include/report/event_config.h | 1 +
src/lib/event_xml_parser.c | 7 +++++++
src/plugins/report_Bugzilla.xml.in | 1 +
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/cli/report.c b/src/cli/report.c
index 9374a3f..7866574 100644
--- a/src/cli/report.c
+++ b/src/cli/report.c
@@ -744,7 +744,7 @@ int report(const char *dump_dir_name, int flags)
else
{
const char *rating_str = get_crash_item_content_or_NULL(crash_data, FILENAME_RATING);
- unsigned rating = rating_str ? xatou(rating_str) : 4;
+ unsigned rating = rating_str ? xatou(rating_str) : 0;
/* For every reporter, ask if user really wants to report using it. */
for (GList *li = report_events; li; li = li->next)
@@ -769,17 +769,14 @@ int report(const char *dump_dir_name, int flags)
continue;
}
- /* TODO: npajkovs; not implemented yet */
- //const char *rating_required = get_map_string_item_or_NULL(single_plugin_settings, "RatingRequired");
- //if (rating_required
- // && string_to_bool(rating_required) == true
- if (rating < 3)
+ if (config->rating_required && rating < 3)
{
puts(_("Reporting disabled because the backtrace is unusable"));
const char *package = get_crash_item_content_or_NULL(crash_data, FILENAME_PACKAGE);
if (package && package[0])
- printf(_("Please try to install debuginfo manually using the command: \"debuginfo-install %s\" and try again\n"), package);
+ printf(_("Please try to install debuginfo manually using the"
+ " command: \"debuginfo-install %s\" and try again\n"), package);
plugins++;
errors++;
diff --git a/src/include/report/event_config.h b/src/include/report/event_config.h
index 8dcfb9f..52b548e 100644
--- a/src/include/report/event_config.h
+++ b/src/include/report/event_config.h
@@ -68,6 +68,7 @@ typedef struct
//char *title; //window title - not used right now, maybe the "name" is enough?
//char *action;//action description to show in gui like: Upload report to the Red Hat bugzilla"
char *description; // "Report to ...."/"Save to file"
+ int rating_required;
GList *options;
} event_config_t;
diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c
index 8bb8902..aea2f76 100644
--- a/src/lib/event_xml_parser.c
+++ b/src/lib/event_xml_parser.c
@@ -23,6 +23,7 @@
#define LABEL_ELEMENT "label"
#define DESCRIPTION_ELEMENT "description"
#define ALLOW_EMPTY_ELEMENT "allow-empty"
+#define RATING_REQUIRED_ELEMENT "rating-required"
#define OPTION_ELEMENT "option"
//#define ACTION_ELEMENT "action"
#define NAME_ELEMENT "name"
@@ -294,6 +295,12 @@ static void text(GMarkupParseContext *context,
}
return;
}
+ if (strcmp(inner_element, RATING_REQUIRED_ELEMENT) == 0)
+ {
+ VERB2 log("rating-required:'%s'", text_copy);
+ ui->rating_required = string_to_bool(text_copy);
+ return;
+ }
}
free(text_copy);
}
diff --git a/src/plugins/report_Bugzilla.xml.in b/src/plugins/report_Bugzilla.xml.in
index 6c87ad9..f5d04d2 100644
--- a/src/plugins/report_Bugzilla.xml.in
+++ b/src/plugins/report_Bugzilla.xml.in
@@ -2,6 +2,7 @@
<event>
<_name>Bugzilla</_name>
<_description>Report to Bugzilla bug tracker</_description>
+ <rating-required>yes</rating-required>
<options>
<option type="text" name="Bugzilla_BugzillaURL">
<_label>Bugzilla URL</_label>
--
1.7.1
13 years, 1 month