Re: [Libunwind-devel] [PATCH 5/5] Search MiniDebugInfo for procedure names
by Martin Milata
On Sat, Aug 11, 2012 at 21:34:35 -0700, Arun Sharma wrote:
> On Fri, Aug 10, 2012 at 7:03 AM, Martin Milata <mmilata(a)redhat.com> wrote:
>
> >
> > + /* Closer symbol was found (possibly truncated). */
> > + if (ret_mdi == 0 || ret_mdi == -UNW_ENOMEM)
> > + {
> > + ret = ret_mdi;
> > + }
> > +
> > + munmap (mdi.image, mdi.size);
>
> If the second lookup fails with -UNW_ENOMEM, looks like you propagate
> that error up the stack. Why not propagate the best known answer from
> the first lookup?
The idea is that usually only the closest symbol is useful as it
corresponds to the procedure name. If the closest symbol is too large
and some other one that fits in the buffer is returned, it will most
likely be name of some unrelated procedure.
Also, such behaviour is consistent with what the original
unw_get_proc_name does - it returns the closest symbol regardless of
whether it's truncated or not. Or am I missing something?
Martin
11 years, 8 months
ABRT Graphical User Interface for GNOME
by Jakub Filak
Hi folks,
I've been working on a new ABRT gui for a week and I've decided to upload the
project on github. The GUI is designed according to the following proposal
https://live.gnome.org/Design/Apps/Oops
The project is in the very first state of development. I personally use it as
playground, hence you may feel a lack of comments ;)
Take a look and do not hesitate to give me any feedback. (Well, I am not a
python developer, so, comments about coding style are really appreciated.)
https://github.com/jfilak/abrt-gnome-oops/
Best regards,
Jakub
11 years, 8 months
[PATCH 0/5] MiniDebugInfo support for unw_get_proc_name
by Martin Milata
Hello everyone,
following patches add support for XZ-compressed symbol tables, also known as
MiniDebugInfo.
In short, MiniDebugInfo-containing binary is created by taking separate
debuginfo ELF containing only the symbol table, compressing it with XZ and
stuffing it into the .gnu_debugdata section of the binary. This feature will be
used in next Fedora release and ABRT (among others), which is planned to be
based on libunwind by then, would like to take advantage of it. Some more
background can be found here [1].
Please review, I'll be happy to modify the patches according to your
suggestions.
Thanks,
Martin
[1] http://fedoraproject.org/wiki/Features/MiniDebugInfo
[2] https://github.com/b42/libunwind/tree/minidebuginfo
* * *
Martin Milata (5):
Make coredump test also test unw_get_proc_name
Add liblzma detection to configure script
MiniDebugInfo test: tests/run-coredump-unwind-mdi
Refactor parts of elfxx.c to allow reusing code
Search MiniDebugInfo for procedure names
configure.in | 16 +++
src/Makefile.am | 3 +
src/elfxx.c | 279 ++++++++++++++++++++++++++++++++++-------
tests/Makefile.am | 7 +-
tests/run-coredump-unwind | 47 ++++++-
tests/run-coredump-unwind-mdi | 8 ++
tests/test-coredump-unwind.c | 20 +++
7 files changed, 326 insertions(+), 54 deletions(-)
create mode 100755 tests/run-coredump-unwind-mdi
--
1.7.7.6
11 years, 9 months
[PATCH] rhbz#846389: reporter-bugzilla posts user's comment as comment #1 in case of kerneloopses
by Jakub Filak
* this functionality was put to the rhbz_new_bug() function because it
is a part of new bug creation process
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/plugins/rhbz.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index b4a5a06..7ea9ff6 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -624,6 +624,9 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
FILENAME_ANALYZER);
const char *tainted_short = problem_data_get_content_or_NULL(problem_data,
FILENAME_TAINTED_SHORT);
+ const char *comment = problem_data_get_content_or_NULL(problem_data,
+ FILENAME_COMMENT);
+
struct strbuf *buf_summary = strbuf_new();
if (analyzer && strcmp(analyzer, "libreport") == 0)
@@ -660,9 +663,6 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
}
else
{
- const char *comment = problem_data_get_content_or_NULL(problem_data,
- FILENAME_COMMENT);
-
char *bz_dsc = make_description(problem_data, (char**)g_additional_info_files,
CD_TEXT_ATT_SIZE_BZ, MAKEDESC_SHOW_MULTILINE | MAKEDESC_WHITELIST);
@@ -751,6 +751,14 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
free(r);
log(_("New bug id: %i"), new_bug_id);
+
+ if (comment && analyzer && strcmp(analyzer, "Kerneloops") == 0)
+ {
+ /* Please, see rhbz#711591, rhbz#795548 and rhbz#846389 */
+ log("Adding comment #1 with user's comment to kernel bug %i", new_bug_id);
+ rhbz_add_comment(ax, new_bug_id, comment, 0);
+ }
+
return new_bug_id;
}
--
1.7.11.2
11 years, 9 months
[PATCH] Provide package data for kernel oops
by Richard Marko
Required for reporter-ureport to work with kernel oopses.
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
src/plugins/koops_event.conf | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/plugins/koops_event.conf b/src/plugins/koops_event.conf
index 4d75110..e050cae 100644
--- a/src/plugins/koops_event.conf
+++ b/src/plugins/koops_event.conf
@@ -4,6 +4,24 @@ EVENT=post-create analyzer=Kerneloops
dmesg >dmesg &&
abrt-action-generate-core-backtrace
+ echo "Looking for kernel package"
+ package=$( rpm -q kernel | grep $( cat kernel | cut -d' ' -f1 ))
+ if [ $? == 0 ]; then
+ echo "Kernel package $package found"
+ rpm -q --qf "%{name}\n" $package > pkg_name
+ rpm -q --qf "%{arch}\n" $package > pkg_arch
+ rpm -q --qf "%{version}\n" $package > pkg_version
+ rpm -q --qf "%{release}\n" $package > pkg_release
+ epoch=$( rpm -q --qf "%{epoch}" $package )
+ if [ $epoch == "(none)" ]; then
+ echo "0" > pkg_epoch
+ else
+ echo "$epoch" > pkg_epoch
+ fi
+ else
+ echo "Kernel package not found"
+ fi
+
# If you want behavior similar to one provided by kerneloops daemon
# distributed by kerneloops.org - that is, if you want
# oopses to be reported automatically and immediately without
--
1.7.11.2
11 years, 9 months
[PATCH 0/4] allow users to refuse sending sensitive data
by Jakub Filak
New style of reporting automatically processes event chains. The default event
chain for report-gtk and report-cli contains analyze_RetraceServer event. This
event sends a core file somewhere to the Internet. In the current state, a user
notices that a core file is uploaded somewhere after uploading process started.
If a core file is tiny a user won't most likely notice this uploading because
of automatic execution of next event from event chain.
This set of patches adds a new event configuration option named
'sending-sensitive-data'. If an event has configured this option to value 'yes'
a reporter must ask for permission to run the event.
Jakub Filak (4):
trac#660: add support for sendining-sensitive-data event option
trac#660: report-gtk: introduce generic ask_yes_no() function for
options
trac#660: report-gtk asks for permission to send sensitive data
trac#660: report-cli asks for premission to send sensitive data
src/cli/cli-report.c | 11 +++++++
src/gui-wizard-gtk/wizard.c | 79 ++++++++++++++++++++++++++++++++++-----------
src/include/event_config.h | 1 +
src/lib/event_xml_parser.c | 5 +++
4 files changed, 77 insertions(+), 19 deletions(-)
--
1.7.11.2
11 years, 9 months
[PATCH 1/2] use -Werror GCC option only for build of rpm
by Jakub Filak
* Makefiles : -Werror option moved abrt.spec
-Wall -Wwrite-strings moved to configure.ac (default
options)
* configure.ac : Remove 'silent-rule' from AM_INIT_AUTOMAKE and use
AM_SILENT_RULES macro with argument 'yes' to make build of libreport
silent by default. Those who want verbose build output may configure
with --disable-silent-rules or use "make V=1".
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
abrt.spec.in | 3 +--
configure.ac | 13 +++++++++----
src/applet/Makefile.am | 6 ++----
src/cli/Makefile.am | 3 +--
src/daemon/Makefile.am | 13 ++++---------
src/dbus/Makefile.am | 4 +---
src/gui-gtk/Makefile.am | 6 ++----
src/hooks/Makefile.am | 2 --
src/lib/Makefile.am | 1 -
src/plugins/Makefile.am | 39 +++++++++++++--------------------------
10 files changed, 33 insertions(+), 57 deletions(-)
diff --git a/abrt.spec.in b/abrt.spec.in
index a79d809..972ce92 100644
--- a/abrt.spec.in
+++ b/abrt.spec.in
@@ -236,8 +236,7 @@ uses PolicyKit to authorize to access the problem data.
%build
autoconf
-%configure
-CFLAGS="-fno-strict-aliasing"
+CFLAGS="%{optflags} -Werror" %configure --disable-silent-rules
make %{?_smp_mflags}
%install
diff --git a/configure.ac b/configure.ac
index a51cf4f..bb2b986 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,8 +3,13 @@ AC_INIT([abrt],
[crash-catcher(a)fedorahosted.org])
AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign silent-rules])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+# Support silent build rules. Disable by either passing --disable-silent-rules
+# to ./configure or passing V=1 to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
+# The 'yes' argument is undocumented but it is common knowledge that it works.
+AM_SILENT_RULES([yes])
+
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
@@ -13,12 +18,12 @@ AC_PROG_LN_S
AC_SYS_LARGEFILE
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE \
- -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -std=gnu99 -Wall"
+ -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -std=gnu99 -Wall -Wwrite-strings"
AC_ARG_ENABLE(debug,
[AC_HELP_STRING([--enable-debug],
[Enable debug information])],
- [CFLAGS="$CFLAGS -DDEBUG -ggdb -g"])
+ [CFLAGS="$CFLAGS -DDEBUG -ggdb -g -O0"])
dnl ****** INTERNATIONALIZATION **********************
GETTEXT_PACKAGE=abrt
@@ -114,7 +119,7 @@ AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
AM_MISSING_PROG([AUTOM4TE], [autom4te])
# Needed by tests/atlocal.in.
-AC_SUBST([O0CFLAGS], [`echo $CFLAGS | sed 's/-O[[0-9]] *//'`])
+AC_SUBST([O0CFLAGS], [`echo $CFLAGS | sed 's/-O[[0-9]] *//' | sed 's/-Werror//'`])
AC_CONFIG_HEADERS([config.h])
diff --git a/src/applet/Makefile.am b/src/applet/Makefile.am
index 28bd769..d11951b 100644
--- a/src/applet/Makefile.am
+++ b/src/applet/Makefile.am
@@ -11,8 +11,7 @@ abrt_applet_CPPFLAGS = \
$(GTK_CFLAGS) \
$(DBUS_CFLAGS) \
$(LIBREPORT_GTK_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
# -I/usr/include/glib-2.0
# -I/usr/lib/glib-2.0/include
# $(LIBNOTIFY_CFLAGS)
@@ -32,8 +31,7 @@ abrt_applet_LDADD = \
#test_report_CPPFLAGS = \
# -I$(srcdir)/../include/report -I$(srcdir)/../include \
# $(GLIB_CFLAGS) \
-# -D_GNU_SOURCE \
-# -Wall -Wwrite-strings -Werror
+# -D_GNU_SOURCE
#test_report_LDADD = \
# ../lib/libreport.la
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index 1524312..5b39353 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -14,8 +14,7 @@ abrt_cli_SOURCES = $(CLI_C) $(BUILTIN_C) builtin-cmd.h abrt-cli-core.h
abrt_cli_CFLAGS = \
-I$(srcdir)/../include \
-I$(srcdir)/../lib \
- $(LIBREPORT_CFLAGS) \
- -Wwrite-strings -Werror
+ $(LIBREPORT_CFLAGS)
abrt_cli_LDADD = \
$(LIBREPORT_LIBS) \
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index 90187d4..2e24403 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -24,9 +24,7 @@ abrtd_CPPFLAGS = \
-DLIBEXEC_DIR=\"$(libexecdir)\" \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings \
- -Werror
+ -D_GNU_SOURCE
abrtd_LDADD = \
../lib/libabrt.la \
$(LIBREPORT_LIBS)
@@ -38,8 +36,7 @@ abrt_server_CPPFLAGS = \
-I$(srcdir)/../lib \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_server_LDADD = \
../lib/libabrt.la \
$(LIBREPORT_LIBS)
@@ -52,8 +49,7 @@ abrt_handle_event_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
$(BTPARSER_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_handle_event_LDADD = \
../lib/libabrt.la \
$(LIBREPORT_LIBS) \
@@ -68,8 +64,7 @@ abrt_action_save_package_data_CPPFLAGS = \
-DCONF_DIR=\"$(CONF_DIR)\" \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_action_save_package_data_LDADD = \
$(RPM_LIBS) \
$(LIBREPORT_LIBS) \
diff --git a/src/dbus/Makefile.am b/src/dbus/Makefile.am
index 5f29c71..5b4b7fc 100644
--- a/src/dbus/Makefile.am
+++ b/src/dbus/Makefile.am
@@ -13,9 +13,7 @@ abrt_dbus_CPPFLAGS = \
$(DBUS_CFLAGS) \
$(LIBREPORT_CFLAGS) \
$(POLKIT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings \
- -Werror
+ -D_GNU_SOURCE
abrt_dbus_LDADD = \
$(GIO_LIBS) \
../lib/libabrt.la \
diff --git a/src/gui-gtk/Makefile.am b/src/gui-gtk/Makefile.am
index 76fa731..270ad1b 100644
--- a/src/gui-gtk/Makefile.am
+++ b/src/gui-gtk/Makefile.am
@@ -12,8 +12,7 @@ abrt_gui_CFLAGS = \
$(GTK_CFLAGS) \
$(LIBREPORT_GTK_CFLAGS) \
-D_GNU_SOURCE \
- $(GIO_CFLAGS) \
- -Wall -Wwrite-strings -Werror
+ $(GIO_CFLAGS)
# -I/usr/include/glib-2.0
# -I/usr/lib/glib-2.0/include
# $(LIBNOTIFY_CFLAGS)
@@ -32,8 +31,7 @@ abrt_gui_LDADD = \
#test_report_CPPFLAGS = \
# -I$(srcdir)/../include/report -I$(srcdir)/../include \
# $(GLIB_CFLAGS) \
-# -D_GNU_SOURCE \
-# -Wall -Wwrite-strings -Werror
+# -D_GNU_SOURCE
#test_report_LDADD = \
# ../lib/libreport.la
diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am
index f232779..bbdc472 100644
--- a/src/hooks/Makefile.am
+++ b/src/hooks/Makefile.am
@@ -20,8 +20,6 @@ abrt_hook_ccpp_CPPFLAGS = \
-DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -Wall -Wwrite-strings \
- -Werror \
-D_GNU_SOURCE
abrt_hook_ccpp_LDADD = \
../lib/libabrt.la \
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index f7019ff..fbf784d 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -15,7 +15,6 @@ libabrt_la_SOURCES = \
problem_api.c
libabrt_la_CPPFLAGS = \
- -Wall -Wwrite-strings -Werror \
-I$(srcdir)/../include \
-I$(srcdir)/../lib \
-DVAR_RUN=\"$(VAR_RUN)\" \
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index bb96c6f..0f8a4d4 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -80,8 +80,7 @@ abrt_watch_log_CPPFLAGS = \
-I$(srcdir)/../lib \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_watch_log_LDADD = \
$(GLIB_LIBS) \
$(LIBREPORT_LIBS) \
@@ -94,8 +93,7 @@ abrt_dump_oops_CPPFLAGS = \
-I$(srcdir)/../lib \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_dump_oops_LDADD = \
$(GLIB_LIBS) \
$(LIBREPORT_LIBS) \
@@ -108,8 +106,7 @@ abrt_dump_xorg_CPPFLAGS = \
-I$(srcdir)/../lib \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_dump_xorg_LDADD = \
$(GLIB_LIBS) \
$(LIBREPORT_LIBS) \
@@ -122,8 +119,7 @@ abrt_action_analyze_c_CPPFLAGS = \
-I$(srcdir)/../lib \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_action_analyze_c_LDADD = \
$(LIBREPORT_LIBS) \
../lib/libabrt.la
@@ -135,8 +131,7 @@ abrt_action_analyze_python_CPPFLAGS = \
-I$(srcdir)/../lib \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_action_analyze_python_LDADD = \
$(LIBREPORT_LIBS)
@@ -148,8 +143,7 @@ abrt_action_analyze_oops_CPPFLAGS = \
-I$(srcdir)/../lib \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_action_analyze_oops_LDADD = \
$(LIBREPORT_LIBS) \
../lib/libabrt.la
@@ -161,8 +155,7 @@ abrt_action_trim_files_CPPFLAGS = \
-I$(srcdir)/../lib \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_action_trim_files_LDADD = \
$(LIBREPORT_LIBS) \
../lib/libabrt.la
@@ -176,8 +169,7 @@ abrt_action_generate_backtrace_CPPFLAGS = \
-DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_action_generate_backtrace_LDADD = \
$(LIBREPORT_LIBS) \
../lib/libabrt.la
@@ -191,8 +183,7 @@ abrt_action_generate_core_backtrace_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
$(BTPARSER_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_action_generate_core_backtrace_LDADD = \
$(LIBREPORT_LIBS) \
$(BTPARSER_LIBS) \
@@ -206,8 +197,7 @@ abrt_action_analyze_backtrace_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(LIBREPORT_CFLAGS) \
$(BTPARSER_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_action_analyze_backtrace_LDADD = \
$(LIBREPORT_LIBS) \
$(BTPARSER_LIBS)
@@ -233,8 +223,7 @@ abrt_retrace_client_SOURCES = \
$(NSS_CFLAGS) \
$(GLIB_CFLAGS) \
-D_GNU_SOURCE \
- $(LIBREPORT_CFLAGS) \
- -Wall -Wwrite-strings -Werror
+ $(LIBREPORT_CFLAGS)
abrt_retrace_client_LDADD = \
$(LIBREPORT_LIBS) \
$(BTPARSER_LIBS) \
@@ -249,8 +238,7 @@ abrt_dedup_client_SOURCES = \
$(NSS_CFLAGS) \
$(GLIB_CFLAGS) \
-D_GNU_SOURCE \
- $(LIBREPORT_CFLAGS) \
- -Wall -Wwrite-strings -Werror
+ $(LIBREPORT_CFLAGS)
abrt_dedup_client_LDADD = \
$(LIBREPORT_LIBS) \
$(BTPARSER_LIBS) \
@@ -266,8 +254,7 @@ abrt_bodhi_SOURCES = \
$(LIBREPORT_WEB_CFLAGS) \
$(JSON_C_CFLAGS) \
$(RPM_CFLAGS) \
- -D_GNU_SOURCE \
- -Wall -Wwrite-strings -Werror
+ -D_GNU_SOURCE
abrt_bodhi_LDADD = \
$(JSON_C_LIBS) \
$(RPM_LIBS) \
--
1.7.11.2
11 years, 9 months
[PATCH] trac#641 : abrt-gui displays 'N/A' string instead of empty lines
by Jakub Filak
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gui-gtk/main.c | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/gui-gtk/main.c b/src/gui-gtk/main.c
index 12b14e9..87c8205 100644
--- a/src/gui-gtk/main.c
+++ b/src/gui-gtk/main.c
@@ -153,6 +153,19 @@ static void watch_this_dir(const char *dir_name)
}
}
+/* Returns non 0 if str is NULL or if str consists from white spaces */
+static int is_null_or_mepty_string(const char *str)
+{
+ if (!str)
+ return 1;
+
+ while(*str)
+ if (!isspace(*str++))
+ return 0;
+
+ return 1;
+}
+
static void add_directory_to_dirlist(const char *problem_dir_path, gpointer data)
{
bool use_dbus = (bool)data;
@@ -192,15 +205,25 @@ static void add_directory_to_dirlist(const char *problem_dir_path, gpointer data
time_buf[time_len] = '\0';
}
- const char *not_reportable_reason = problem_data_get_content_or_NULL(pd, FILENAME_NOT_REPORTABLE);
- const char *reason = problem_data_get_content_or_NULL(pd, FILENAME_REASON);
+ const char *reason = problem_data_get_content_or_NULL(pd, FILENAME_NOT_REPORTABLE);
+ if (is_null_or_mepty_string(reason)) /* if problem is NOT not reportable we use reason */
+ {
+ reason = problem_data_get_content_or_NULL(pd, FILENAME_REASON);
+ if (is_null_or_mepty_string(reason)) /* if we don't have reason we use 'N/A' */
+ reason = "N/A";
+ }
/* the source of the problem:
* - first we try to load component, as we use it on Fedora
*/
const char *source = problem_data_get_content_or_NULL(pd, FILENAME_COMPONENT);
- if (!source) /* if we don't have component, we fallback to executable */
+ if (is_null_or_mepty_string(source)) /* if we don't have component, we fallback to executable */
+ {
source = problem_data_get_content_or_NULL(pd, FILENAME_EXECUTABLE);
+ if (is_null_or_mepty_string(source)) /* even if we don't have executable, we use 'N/A' */
+ source = "N/A";
+ }
+
const char *msg = problem_data_get_content_or_NULL(pd, FILENAME_REPORTED_TO);
GtkListStore *list_store = s_dumps_list_store;
@@ -215,7 +238,7 @@ static void add_directory_to_dirlist(const char *problem_dir_path, gpointer data
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter,
COLUMN_SOURCE, source,
- COLUMN_REASON, not_reportable_reason ? : reason,
+ COLUMN_REASON, reason,
//OPTION: time format
COLUMN_LATEST_CRASH_STR, time_buf,
COLUMN_LATEST_CRASH, t,
--
1.7.10.4
11 years, 9 months
[PATCH 0/3] improvements of processing of event chains in report-gtk
by Jakub Filak
This set of patches attempts to make report-gtk fluent and user friendly.
The first patch replaces the 'Forward' button by the 'Close' button when click
on the 'Forward' button will close the report-gtk.
The second patch terminates event chain when user canceled stealing of a
directory.
The third patch attempts to make processing of event chain as fast as it is
possible. Hence next events are started automatically when the previous one was
successfull and the next event doesn't require reviewing of problem data.
Run, tested. Please review.
Jakub Filak (3):
trac#640 : report-gtk replaces 'Forward' button with 'Close' button
on finished reporting
trac#641 : don't allow event chain to continue, if user don't want to
steal a directory
trac#642 : run the next event if the current one finished without
errors
src/gui-wizard-gtk/wizard.c | 190 ++++++++++++++++++++++++++++++++-----------
1 file changed, 143 insertions(+), 47 deletions(-)
--
1.7.10.4
11 years, 9 months
[PATCH] trac#622 : introduction of event chain in report-cli
by Jakub Filak
* naive implementation of running of event chain in report-cli
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/cli/cli-report.c | 223 ++++++++++++++++++++++++++++++++++++++------------
src/cli/cli-report.h | 1 +
src/cli/cli.c | 34 ++++----
3 files changed, 187 insertions(+), 71 deletions(-)
diff --git a/src/cli/cli-report.c b/src/cli/cli-report.c
index 988bfc7..e204435 100644
--- a/src/cli/cli-report.c
+++ b/src/cli/cli-report.c
@@ -520,10 +520,30 @@ static char *do_log_and_save_line(char *log_line, void *param)
l_state->last_line = log_line;
return NULL;
}
+
+static int run_event(struct run_event_state *state, const char *dump_dir_name,
+ const char *event, struct logging_state *l_state)
+{
+ // Export overridden settings as environment variables
+ GList *env_list = export_event_config(event);
+
+ int r = run_event_on_dir_name(state, dump_dir_name, event);
+ if (r == 0 && state->children_count == 0)
+ {
+ l_state->last_line = xasprintf("Error: no processing is specified for event '%s'",
+ event);
+ r = -1;
+ }
+
+ // Unexport overridden settings
+ unexport_event_config(env_list);
+
+ return r;
+}
+
static int run_events(const char *dump_dir_name, GList *events, const char *event_type)
{
int error_cnt = 0;
- GList *env_list = NULL;
// Run events
struct logging_state l_state;
@@ -534,18 +554,7 @@ static int run_events(const char *dump_dir_name, GList *events, const char *even
for (GList *li = events; li; li = li->next)
{
char *event = (char *) li->data;
-
- // Export overridden settings as environment variables
- env_list = export_event_config(event);
-
- int r = run_event_on_dir_name(run_state, dump_dir_name, event);
- if (r == 0 && run_state->children_count == 0)
- {
- l_state.last_line = xasprintf("Error: no processing is specified for event '%s'",
- event);
- r = -1;
- }
- if (r == 0)
+ if (run_event(run_state, dump_dir_name, event, &l_state) == 0)
{
printf("%s: ", event);
if (l_state.last_line)
@@ -560,14 +569,11 @@ static int run_events(const char *dump_dir_name, GList *events, const char *even
event,
l_state.last_line ? ": " : "",
l_state.last_line ? l_state.last_line : ""
- );
- error_cnt++;
+ );
+ ++error_cnt;
}
free(l_state.last_line);
l_state.last_line = NULL;
-
- // Unexport overridden settings
- unexport_event_config(env_list);
}
free_run_event_state(run_state);
@@ -742,6 +748,51 @@ int collect(const char *dump_dir_name, int batch)
return errors;
}
+static int review_problem_data(const char *dump_dir_name, problem_data_t *problem_data)
+{
+ /* Open text editor and give a chance to review the backtrace etc */
+ create_fields_for_editor(problem_data);
+ int result = run_report_editor(problem_data);
+ if (result != 0)
+ return 1;
+
+ /* Save comment, backtrace */
+ struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
+ if (dd)
+ {
+ //TODO: we should iterate through problem_data and modify all modifiable fields
+ const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT);
+ const char *backtrace = problem_data_get_content_or_NULL(problem_data, FILENAME_BACKTRACE);
+ if (comment)
+ dd_save_text(dd, FILENAME_COMMENT, comment);
+ if (backtrace)
+ dd_save_text(dd, FILENAME_BACKTRACE, backtrace);
+ dd_close(dd);
+ }
+
+ return 0;
+}
+
+static int is_backtrace_rating_usable(event_config_t *config, problem_data_t *problem_data)
+{
+ char *usability_description = NULL;
+ char *usability_detail = NULL;
+ const bool usable_rating = check_problem_rating_usability(config, problem_data,
+ &usability_description,
+ &usability_detail);
+
+ if (!usable_rating)
+ {
+ printf("%s\n", usability_description);
+ printf("%s\n", usability_detail);
+ }
+
+ free(usability_description);
+ free(usability_detail);
+
+ return usable_rating;
+}
+
/* Report the crash */
int report(const char *dump_dir_name, int flags)
{
@@ -804,30 +855,12 @@ int report(const char *dump_dir_name, int flags)
problem_data_t *problem_data = create_problem_data_from_dump_dir(dd);
dd_close(dd);
- if (!(flags & (CLI_REPORT_BATCH)))
+ if (!(flags & (CLI_REPORT_BATCH))
+ && review_problem_data(dump_dir_name, problem_data))
{
- /* Open text editor and give a chance to review the backtrace etc */
- create_fields_for_editor(problem_data);
- int result = run_report_editor(problem_data);
- if (result != 0)
- {
- problem_data_free(problem_data);
- free(report_events_as_lines);
- return 1;
- }
- /* Save comment, backtrace */
- dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
- if (dd)
- {
-//TODO: we should iterate through problem_data and modify all modifiable fields
- const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT);
- const char *backtrace = problem_data_get_content_or_NULL(problem_data, FILENAME_BACKTRACE);
- if (comment)
- dd_save_text(dd, FILENAME_COMMENT, comment);
- if (backtrace)
- dd_save_text(dd, FILENAME_BACKTRACE, backtrace);
- dd_close(dd);
- }
+ problem_data_free(problem_data);
+ free(report_events_as_lines);
+ return 1;
}
/* Get possible reporters associated with this particular crash */
@@ -885,17 +918,8 @@ int report(const char *dump_dir_name, int flags)
if (!is_number_in_string(i, wanted_reporters))
continue;
- char *usability_description = NULL;
- char *usability_detail = NULL;
- const bool usable_rating = check_problem_rating_usability(config, problem_data,
- &usability_description,
- &usability_detail);
-
- if (!usable_rating)
+ if (!is_backtrace_rating_usable(config, problem_data))
{
- printf("%s\n", usability_description);
- printf("%s\n", usability_detail);
-
errors++;
goto next_plugin;
}
@@ -914,8 +938,6 @@ int report(const char *dump_dir_name, int flags)
next_plugin:
plugins++;
- free(usability_description);
- free(usability_detail);
}
}
@@ -924,3 +946,98 @@ next_plugin:
list_free_with_free(report_events);
return errors;
}
+
+struct chain_logging_param
+{
+ struct logging_state l_state;
+ bool terminate;
+};
+
+static char *do_log_and_terminate_chain_on_request(char *log_line, void *param)
+{
+ struct chain_logging_param *arg = (struct chain_logging_param *)param;
+
+ arg->terminate = strcmp("THANKYOU", log_line) == 0;
+
+ return do_log_and_save_line(log_line, &(arg->l_state));
+}
+
+/*
+ * Runs event from chain. Perform the following steps for each event from chain.
+ * 1. Terminates a chain run if a backtrace is not usable.
+ * 2. Asks for missing settings.
+ * 3. Performs review of problem data if event requires review.
+ * 4. Runs events commands.
+ * 5. Terminates a chain run if any event from the chain requires termination
+ * (prints THANKYOU to stdout in the current implementation)
+ * 6. Terminates a chain run if any error occurs.
+ * 7. Continues immediately with processing of next event.
+ */
+int run_events_chain(const char *dump_dir_name, GList *chain)
+{
+ struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
+ if (!dd)
+ return -1;
+
+ problem_data_t *problem_data = create_problem_data_from_dump_dir(dd);
+
+ dd_close(dd);
+
+ struct chain_logging_param chain_state = {
+ .l_state = {
+ .last_line = NULL,
+ },
+ .terminate = false,
+ };
+
+ struct run_event_state *run_state = new_run_event_state();
+ run_state->logging_callback = do_log_and_terminate_chain_on_request;
+ run_state->logging_param = &chain_state;
+
+ int returncode = 0;
+
+ for (GList *eitem = chain; !chain_state.terminate && eitem; eitem = g_list_next(eitem))
+ {
+ const char *const event = (const char *)eitem->data;
+ event_config_t *config = get_event_config(event);
+
+ if (!is_backtrace_rating_usable(config, problem_data))
+ /* it is not a failure of event if the backtrace is unusable */
+ break;
+
+ if (config)
+ {
+ /* can't fail */
+ ask_for_missing_settings(event);
+
+ /* review problem data only if the event needs it */
+ if (!config->ec_skip_review
+ && review_problem_data(dump_dir_name, problem_data))
+ {
+ /* review failed, an error message was already logged */
+ returncode = -1;
+ break;
+ }
+ }
+
+ returncode = run_event(run_state, dump_dir_name, event, &chain_state.l_state);
+ if (returncode != 0)
+ {
+ error_msg("'%s' event was not successful%s%s",
+ event,
+ chain_state.l_state.last_line ? ": " : "",
+ chain_state.l_state.last_line ? chain_state.l_state.last_line : ""
+ );
+ break;
+ }
+
+ free(chain_state.l_state.last_line);
+ chain_state.l_state.last_line = NULL;
+ }
+
+ free_run_event_state(run_state);
+ free(chain_state.l_state.last_line);
+ problem_data_free(problem_data);
+
+ return returncode;
+}
diff --git a/src/cli/cli-report.h b/src/cli/cli-report.h
index b34293d..8dd3773 100644
--- a/src/cli/cli-report.h
+++ b/src/cli/cli-report.h
@@ -32,6 +32,7 @@ enum {
};
int report(const char *dump_dir_name, int flags);
int collect(const char *dump_dir_name, int batch);
+int run_events_chain(const char *dump_dir_name, GList *chain);
#ifdef __cplusplus
}
diff --git a/src/cli/cli.c b/src/cli/cli.c
index 66ebbe2..5a221ad 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -23,10 +23,18 @@
#include "internal_libreport.h"
#include "cli-report.h"
-static char *do_log(char *log_line, void *param)
+static char *steal_directory_if_needed(char *dump_dir_name)
{
- log("%s", log_line);
- return log_line;
+ struct dump_dir *dd = open_directory_for_writing(dump_dir_name,
+ /* ask callback */ NULL);
+
+ if (dd)
+ {
+ dump_dir_name = xstrdup(dd->dd_dirname);
+ dd_close(dd);
+ }
+
+ return dump_dir_name;
}
int main(int argc, char** argv)
@@ -47,7 +55,7 @@ int main(int argc, char** argv)
textdomain(PACKAGE);
#endif
- const char *event_name = NULL;
+ GList *event_list = NULL;
const char *pfx = "";
/* Can't keep these strings/structs static: _() doesn't support that */
@@ -77,7 +85,7 @@ int main(int argc, char** argv)
struct options program_options[] = {
/* short_name long_name value parameter_name help */
OPT_OPTSTRING('L', NULL , &pfx, "PREFIX", _("List possible events [which start with PREFIX]")),
- OPT_STRING( 'e', NULL , &event_name, "EVENT", _("Run EVENT on DUMP_DIR")),
+ OPT_LIST( 'e', "event" , &event_list, "EVENT", _("Run only these events")),
OPT_BOOL( 'a', "analyze", NULL, _("Run analyze event(s) on DUMP_DIR")),
OPT_BOOL( 'c', "collect", NULL, _("Run collect event(s) on DUMP_DIR")),
OPT_BOOL( 'r', "report" , NULL, _("Analyze, collect and report problem data in DUMP_DIR")),
@@ -144,12 +152,8 @@ int main(int argc, char** argv)
}
case OPT_run_event: /* -e EVENT: run event */
{
- struct run_event_state *run_state = new_run_event_state();
- run_state->logging_callback = do_log;
- int r = run_event_on_dir_name(run_state, dump_dir_name, event_name);
- if (r == 0 && run_state->children_count == 0)
- error_msg_and_die("No actions are found for event '%s'", event_name);
- free_run_event_state(run_state);
+ dump_dir_name = steal_directory_if_needed(dump_dir_name);
+ exitcode = run_events_chain(dump_dir_name, event_list);
break;
}
case OPT_analyze:
@@ -184,13 +188,7 @@ int main(int argc, char** argv)
}
case OPT_report:
{
- struct dump_dir *dd = open_directory_for_writing(dump_dir_name, NULL);
-
- if (dd)
- {
- dump_dir_name = xstrdup(dd->dd_dirname);
- dd_close(dd);
- }
+ dump_dir_name = steal_directory_if_needed(dump_dir_name);
exitcode = report(dump_dir_name,
(always ? CLI_REPORT_BATCH : 0));
--
1.7.10.4
11 years, 9 months