[PATCH] add include directive to abrt_event.conf parser
by Denys Vlasenko
Basically, "include GLOB_PATTERN" line expands GLOB_PATTERN
and recurses int every matching file.
Another small change makes it possible to have one rule
to span lines: our current default abrt_event.conf has
sosreport invocation which looks very ugly. Patch rewrites
it in multi-line form.
Patch is tested by adding include post-create.d/*.conf
to /etc/abrt/abrt_event.conf, running
abrt-handle-crashdump -vvv -d /var/spool/abrt/ccpp-1291820534-28933 -e post-create
and observing the results.
The comment in src/daemon/abrt_event.conf is modified to explain
the recognized syntax.
Please review.
--
vda
diff -x '*.po' -d -urpN abrt.7/src/daemon/abrt_event.conf abrt.8/src/daemon/abrt_event.conf
--- abrt.7/src/daemon/abrt_event.conf 2011-01-11 14:40:43.000000000 +0100
+++ abrt.8/src/daemon/abrt_event.conf 2011-01-12 14:55:35.348507882 +0100
@@ -1,17 +1,31 @@
-# This table specifies which programs should be run
+# This configuration file specifies which programs should be run
# when the specified event occurs in crash dump lifetime.
#
# Example:
# EVENT=post-create { pwd; date; }>/tmp/dt; echo $HOSTNAME `uname -r`
#
-# Each line may have conditions to be checked
-# before the program is run.
+# Rule starts with a line with non-space leading character.
+# All subsequent lines which start with space or tab form one rule.
+# Note that separating newline is *retained*. Example:
+# EVENT=post-create date >/tmp/dt # semicolon is not needed here!
+# echo $HOSTNAME `uname -r`
+#
+# Rules may be commented out with #. One # is sufficient to comment out
+# even a multi-line rule (no need to comment out every line).
+#
+# Rule of the form "include GLOB_PATTERN" recurses to each file which matches
+# GLOB_PATTERN. Example: "include post-create.d/*.conf"
+#
+# Any other rules specify which programs to run on the crash dump.
+#
+# Each rule may have conditions to be checked before the program is run.
#
# Conditions have form VAR=VAL, where VAR is either word "EVENT"
# or a name of crash dump element to be checked (for example,
# "executable", "package", hostname" etc).
#
-# If all conditions match, the program is run in the shell.
+# If all conditions match, the remaining part of the rule
+# (the "program" part) is run in the shell.
# All shell language constructs are valid.
# All stdout and stderr output is captured and passed to abrt
# and possibly to abrt's frontends and shown to the user.
@@ -22,7 +36,7 @@
# the error message indicating the reason of the failure,
# and may be used by abrt as such.
#
-# If the program terminates successfully, next line is read
+# If the program terminates successfully, next rule is read
# and processed. This process is repeated until the end of this file.
# abrt-action-analyze-c needs package name, save package data first
@@ -38,7 +52,19 @@ EVENT=post-create analyzer=Kerneloops
# user interaction, uncomment this line:
#EVENT=post-create analyzer=Kerneloops abrt-action-kerneloops
# Example: if you want to save sosreport immediately at the moment of a crash:
-#EVENT=post-create nice sosreport --tmp-dir "$DUMP_DIR" --batch --only=anaconda --only=bootloader --only=devicemapper --only=filesys --only=hardware --only=kernel --only=libraries --only=memory --only=networking --only=nfsserver --only=pam --only=process --only=rpm -k rpm.rpmva=off --only=ssh --only=startup --only=yum --only=general --only=x11 && { rm sosreport*.md5; mv sosreport*.tar.bz2 sosreport.tar.bz2; mv sosreport*.tar.xz sosreport.tar.xz; true; } 2>/dev/null
+#EVENT=post-create
+ nice sosreport --tmp-dir "$DUMP_DIR" --batch \
+ --only=anaconda --only=bootloader --only=devicemapper \
+ --only=filesys --only=hardware --only=kernel --only=libraries \
+ --only=memory --only=networking --only=nfsserver --only=pam \
+ --only=process --only=rpm -k rpm.rpmva=off --only=ssh \
+ --only=startup --only=yum --only=general --only=x11 \
+ && {
+ rm sosreport*.md5
+ mv sosreport*.tar.bz2 sosreport.tar.bz2
+ mv sosreport*.tar.xz sosreport.tar.xz
+ true
+ } 2>/dev/null
#TODO: implement this (or add this functionality to abrt-action-install-debuginfo):
#EVENT=analyze analyzer=CCpp backtrace= trim-debuginfo-cache /var/cache/abrt-di 4096m
@@ -46,12 +72,14 @@ EVENT=post-create analyzer=Kerneloops
# in the third argument (its format is CACHEDIR[:DEBUGINFODIR...]).
# For example, you can specify a network-mounted shared store
# of all debuginfos this way.
-EVENT=analyze analyzer=CCpp backtrace= abrt-action-install-debuginfo.py "--core=$DUMP_DIR/coredump" "--tmpdir=/var/run/abrt/$$-$RANDOM" --cache=/var/cache/abrt-di
+EVENT=analyze analyzer=CCpp backtrace=
+ abrt-action-install-debuginfo.py --core="$DUMP_DIR/coredump" --tmpdir="/var/run/abrt/$$-$RANDOM" --cache=/var/cache/abrt-di
EVENT=analyze analyzer=CCpp backtrace= abrt-action-generate-backtrace
# Same as "analyze", but executed when user requests "refresh" in GUI
#EVENT=reanalyze analyzer=CCpp trim-debuginfo-cache /var/cache/abrt-di 4096m
-EVENT=reanalyze analyzer=CCpp abrt-action-install-debuginfo.py "--core=$DUMP_DIR/coredump" "--tmpdir=/var/run/abrt/$$-$RANDOM" --cache=/var/cache/abrt-di
+EVENT=reanalyze analyzer=CCpp
+ abrt-action-install-debuginfo.py --core="$DUMP_DIR/coredump" --tmpdir="/var/run/abrt/$$-$RANDOM" --cache=/var/cache/abrt-di
EVENT=reanalyze analyzer=CCpp abrt-action-generate-backtrace
EVENT=report analyzer=Kerneloops abrt-action-kerneloops
diff -x '*.po' -d -urpN abrt.7/src/lib/run_event.c abrt.8/src/lib/run_event.c
--- abrt.7/src/lib/run_event.c 2011-01-06 17:24:09.000000000 +0100
+++ abrt.8/src/lib/run_event.c 2011-01-12 14:56:09.400506770 +0100
@@ -16,6 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <glob.h>
#include "abrtlib.h"
struct run_event_state *new_run_event_state()
@@ -28,14 +29,15 @@ void free_run_event_state(struct run_eve
free(state);
}
-int run_event_on_dir_name(struct run_event_state *state,
+static int run_event_helper(struct run_event_state *state,
const char *dump_dir_name,
- const char *event
+ const char *event,
+ const char *conf_file_name
) {
- FILE *conffile = fopen(CONF_DIR"/abrt_event.conf", "r");
+ FILE *conffile = fopen(conf_file_name, "r");
if (!conffile)
{
- error_msg("Can't open '%s'", CONF_DIR"/abrt_event.conf");
+ error_msg("Can't open '%s'", conf_file_name);
return 1;
}
close_on_exec_on(fileno(conffile));
@@ -53,9 +55,21 @@ int run_event_on_dir_name(struct run_eve
/* Read, match, and execute lines from abrt_event.conf */
int retval = -1;
struct dump_dir *dd = NULL;
- char *line;
- while ((line = xmalloc_fgetline(conffile)) != NULL)
+ char *next_line = xmalloc_fgetline(conffile);
+ while (next_line)
{
+ char *line = next_line;
+ while (1)
+ {
+ next_line = xmalloc_fgetline(conffile);
+ if (!next_line || !isblank(next_line[0]))
+ break;
+ char *old_line = line;
+ line = xasprintf("%s\n%s", line, next_line);
+ free(old_line);
+ free(next_line);
+ }
+
/* Line has form: [VAR=VAL]... PROG [ARGS] */
char *p = skip_whitespace(line);
if (*p == '\0' || *p == '#')
@@ -63,6 +77,43 @@ int run_event_on_dir_name(struct run_eve
VERB3 log("%s: line '%s'", __func__, p);
+ if (strncmp(p, "include", strlen("include")) == 0 && isblank(p[strlen("include")]))
+ {
+ /* include GLOB_PATTERN */
+ p = skip_whitespace(p + strlen("include"));
+
+ const char *last_slash;
+ char *name_to_glob;
+ if (*p != '/'
+ && (last_slash = strrchr(conf_file_name, '/')) != NULL
+ )
+ /* GLOB_PATTERN is relative, and this include is in path/to/file.conf
+ * Construct path/to/GLOB_PATTERN:
+ */
+ name_to_glob = xasprintf("%.*s%s", (int)(last_slash - conf_file_name + 1), conf_file_name, p);
+ else
+ /* Either GLOB_PATTERN is absolute, or this include is in file.conf
+ * (no slashes in its name). Use unchanged GLOB_PATTERN:
+ */
+ name_to_glob = xstrdup(p);
+
+ glob_t globbuf;
+ memset(&globbuf, 0, sizeof(globbuf));
+ VERB3 log("%s: globbing '%s'", __func__, name_to_glob);
+ glob(name_to_glob, 0, NULL, &globbuf);
+ free(name_to_glob);
+ char **name = globbuf.gl_pathv;
+ if (name) while (*name)
+ {
+ VERB3 log("%s: recursing into '%s'", __func__, *name);
+ run_event_helper(state, dump_dir_name, event, *name);
+ VERB3 log("%s: returned from '%s'", __func__, *name);
+ name++;
+ }
+ globfree(&globbuf);
+ goto next_line;
+ }
+
while (1) /* word loop */
{
char *end_word = skip_non_whitespace(p);
@@ -93,7 +144,11 @@ int run_event_on_dir_name(struct run_eve
{
dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
if (!dd)
+ {
+ free(line);
+ free(next_line);
goto stop; /* error (note: dd_opendir logged error msg) */
+ }
}
real_val = malloced_val = dd_load_text_ext(dd, p, DD_FAIL_QUIETLY);
}
@@ -176,13 +231,19 @@ int run_event_on_dir_name(struct run_eve
} /* end of line loop */
stop:
- free(line);
dd_close(dd);
fclose(conffile);
return retval;
}
+int run_event_on_dir_name(struct run_event_state *state,
+ const char *dump_dir_name,
+ const char *event
+) {
+ return run_event_helper(state, dump_dir_name, event, CONF_DIR"/abrt_event.conf");
+}
+
int run_event_on_crash_data(struct run_event_state *state, crash_data_t *data, const char *event)
{
struct dump_dir *dd = create_dump_dir_from_crash_data(data, NULL);
@@ -202,12 +263,17 @@ int run_event_on_crash_data(struct run_e
return r;
}
-char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx)
-{
- FILE *conffile = fopen(CONF_DIR"/abrt_event.conf", "r");
+
+/* TODO: very similar to run_event_helper, try to combine into one fn? */
+static char *list_possible_events_helper(struct dump_dir *dd,
+ const char *dump_dir_name,
+ const char *pfx,
+ const char *conf_file_name
+) {
+ FILE *conffile = fopen(conf_file_name, "r");
if (!conffile)
{
- error_msg("Can't open '%s'", CONF_DIR"/abrt_event.conf");
+ error_msg("Can't open '%s'", conf_file_name);
return NULL;
}
@@ -220,9 +286,21 @@ char *list_possible_events(struct dump_d
unsigned pfx_len = strlen(pfx);
struct strbuf *result = strbuf_new();
- char *line;
- while ((line = xmalloc_fgetline(conffile)) != NULL)
+ char *next_line = xmalloc_fgetline(conffile);
+ while (next_line)
{
+ char *line = next_line;
+ while (1)
+ {
+ next_line = xmalloc_fgetline(conffile);
+ if (!next_line || !isblank(next_line[0]))
+ break;
+ char *old_line = line;
+ line = xasprintf("%s\n%s", line, next_line);
+ free(old_line);
+ free(next_line);
+ }
+
/* Line has form: [VAR=VAL]... PROG [ARGS] */
char *p = skip_whitespace(line);
if (*p == '\0' || *p == '#')
@@ -230,6 +308,43 @@ char *list_possible_events(struct dump_d
VERB3 log("%s: line '%s'", __func__, p);
+ if (strncmp(p, "include", strlen("include")) == 0 && isblank(p[strlen("include")]))
+ {
+ /* include GLOB_PATTERN */
+ p = skip_whitespace(p + strlen("include"));
+
+ const char *last_slash;
+ char *name_to_glob;
+ if (*p != '/'
+ && (last_slash = strrchr(conf_file_name, '/')) != NULL
+ )
+ /* GLOB_PATTERN is relative, and this include is in path/to/file.conf
+ * Construct path/to/GLOB_PATTERN:
+ */
+ name_to_glob = xasprintf("%.*s%s", (int)(last_slash - conf_file_name + 1), conf_file_name, p);
+ else
+ /* Either GLOB_PATTERN is absolute, or this include is in file.conf
+ * (no slashes in its name). Use unchanged GLOB_PATTERN:
+ */
+ name_to_glob = xstrdup(p);
+
+ glob_t globbuf;
+ memset(&globbuf, 0, sizeof(globbuf));
+ VERB3 log("%s: globbing '%s'", __func__, name_to_glob);
+ glob(name_to_glob, 0, NULL, &globbuf);
+ free(name_to_glob);
+ char **name = globbuf.gl_pathv;
+ if (name) while (*name)
+ {
+ VERB3 log("%s: recursing into '%s'", __func__, *name);
+ list_possible_events_helper(dd, dump_dir_name, pfx, *name);
+ VERB3 log("%s: returned from '%s'", __func__, *name);
+ name++;
+ }
+ globfree(&globbuf);
+ goto next_line;
+ }
+
while (1) /* word loop */
{
char *end_word = skip_non_whitespace(p);
@@ -262,7 +377,11 @@ char *list_possible_events(struct dump_d
goto next_word;
dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
if (!dd)
+ {
+ free(line);
+ free(next_line);
goto stop; /* error (note: dd_opendir logged error msg) */
+ }
}
char *real_val = dd_load_text_ext(dd, p, DD_FAIL_QUIETLY);
/* Does VAL match? */
@@ -294,10 +413,14 @@ char *list_possible_events(struct dump_d
} /* end of line loop */
stop:
- free(line);
if (dump_dir_name != NULL)
dd_close(dd);
fclose(conffile);
return strbuf_free_nobuf(result);
}
+
+char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx)
+{
+ return list_possible_events_helper(dd, dump_dir_name, pfx, CONF_DIR"/abrt_event.conf");
+}
13 years, 3 months
ABRT 2.0 feature: /etc/abrt/conf.d/ directories
by Denys Vlasenko
On Fri, 2011-01-07 at 15:29 +0100, Jiri Moskovcak wrote:
> This is the list of feature to complete for ABRT 2.0, once this list is
> finish we'll done with 2.0. The list is probably not complete, so please
> add anything you think is missing. I'd also like to ask you to add some
> comments about how far the feature (you're working on is) and what it
> depends on, so I can then make it into nice roadmap...
>
> = ABRT 2.0 Features (what we need) =
> ...
> /etc/abrt/conf.d/ directory (devels can drop there configuration for
> their packages)
> --> provide a way for maintainers to blacklist their packages without
> changes into abrt package
Let's perform a bit of brainstorming on this.
Fragment of current default /etc/abrt/abrt_event.conf:
# abrt-action-analyze-c needs package name, save package data first
EVENT=post-create abrt-action-save-package-data
EVENT=post-create analyzer=CCpp abrt-action-analyze-c
EVENT=post-create analyzer=Python abrt-action-analyze-python
EVENT=post-create analyzer=Kerneloops abrt-action-analyze-oops
A few ideas how to extend it to pick up config files from a subdir
so that other packages can add/modify post-create event handling:
(1)
[include] /etc/abrt/event.post-create.d/
(2)
EVENT=post-create abrt-handle-crashdump -d "$DUMP_DIR" -e "$EVENT" -c /etc/abrt/event.post-create.d/
(3)
EVENT=post-create for f in /etc/abrt/event.post-create.d/*
do
test -f "$f" || continue
abrt-handle-crashdump -d "$DUMP_DIR" -e "$EVENT" -c "$f" || break
done
Relative pros and cons:
Proposal (1) - new directive "[include] DIR" or "include GLOB_PATTERN" -
allows to statically determine whether a particular dump dir has
any defined "post-create" event handler(s) - config file parser can walk
included config files and find out whether there is a handler.
For "post-create" event it's not that important, but for "report[_FOO]"
events it is: client programs do this in order to determine which
report events make sense for a particular dump dir.
The importance of this depends on whether we envision packages to add
their own configs with handling for *reporting* events (as opposed to
"post-create" even and such). Do we?
Proposals (2) and (3) are similar: instead of making config parser more
complex, they use the power of modularity which new event-based
processing gave us.
They both need abrt-handle-crashdump to be extended with -c CONF_FILE
or -c CONF_FILE_OR_DIR option.
Another useful extension is to allow action to be written in multi-line
form, as shown in proposal (3).
On the minus side, they might look ugly. Do they look ugly to you?
What else we might want/need? Consider the case when packages can add
additional data-collecting steps, but they do not know *when*
this data-collecting should happen - immediately after crash
(post-create event) or at the point when user selects the crash
for reporting ([re]analyze events)?
Proposal (2) can handle this situation by "redirecting" one event to
another,
something like this:
EVENT=post-create abrt-handle-crashdump -d "$DUMP_DIR" -e collect-data -c /etc/abrt/event.collect-data.d/
, making it possible for admin to change when to do data-collecting
by a single edit - changing EVENT=post-create to, say, EVENT=analyze.
Whereas proposal (1) can't do this, and needs even more syntax changes
to make it possible.
That's all from me for now. Your thoughts on this?
As a minimum, indicate which of proposals 1/2/3 looks best
(or "least ugly") to you.
--
vda
13 years, 3 months
[PATCH] move action helpers to /sur/bin
by Denys Vlasenko
Hi,
When abrt-action-foo's were moved to /usr/libexec, they become
non-callable without tweaking $PATH.
Currently, we do it in abrt-handle-crashdump and abrtd.
I discover more and more cases where I need to tweak $PATH.
For example, both
int run_event_on_dir_name(struct run_event_state *state, const char *dump_dir_name, const char *event);
int run_event_on_crash_data(struct run_event_state *state, crash_data_t *data, const char *event);
need to tweak $PATH, or else any function which calls them will
get failures to find abrt-action-foo.
It seems to me that simpler solution would be to move
abrt-action-foo's to /usr/bin. They do not pollute namespace.
They aren't dangerous in any way for ordinary users to run -
in fact, users may legitimately want to run them.
Developers (we) definitely want to run them for testing,
and not having to set up $PATH or use full path
makes it a bit easier.
Any objections?
--
vda
diff -x '*.po' -d -urpN abrt.1/abrt.spec abrt.2/abrt.spec
--- abrt.1/abrt.spec 2010-12-22 16:33:47.000000000 +0100
+++ abrt.2/abrt.spec 2011-01-04 13:07:05.063130781 +0100
@@ -349,7 +349,7 @@ fi
%{_sbindir}/abrt-server
%{_bindir}/abrt-handle-upload
%{_bindir}/abrt-handle-crashdump
-%{_libexecdir}/abrt-action-save-package-data
+%{_bindir}/abrt-action-save-package-data
%config(noreplace) %{_sysconfdir}/%{name}/abrt.conf
%config(noreplace) %{_sysconfdir}/%{name}/abrt_event.conf
%config(noreplace) %{_sysconfdir}/%{name}/gpg_keys
@@ -416,9 +416,9 @@ fi
%dir %{_localstatedir}/cache/abrt-di
%{_libdir}/%{name}/libCCpp.so*
%{_libexecdir}/abrt-hook-ccpp
-%{_libexecdir}/abrt-action-analyze-c
-%{_libexecdir}/abrt-action-install-debuginfo.py*
-%{_libexecdir}/abrt-action-generate-backtrace
+%{_bindir}/abrt-action-analyze-c
+%{_bindir}/abrt-action-install-debuginfo.py*
+%{_bindir}/abrt-action-generate-backtrace
%files addon-kerneloops
%defattr(-,root,root,-)
@@ -428,48 +428,48 @@ fi
%{_mandir}/man7/abrt-KerneloopsScanner.7.gz
%{_libdir}/%{name}/KerneloopsReporter.glade
%{_mandir}/man7/abrt-KerneloopsReporter.7.gz
-%{_libexecdir}/abrt-action-analyze-oops
-%{_libexecdir}/abrt-action-kerneloops
+%{_bindir}/abrt-action-analyze-oops
+%{_bindir}/abrt-action-kerneloops
%files plugin-logger
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/Logger.conf
%{_libdir}/%{name}/Logger.glade
%{_mandir}/man7/abrt-Logger.7.gz
-%{_libexecdir}/abrt-action-print
+%{_bindir}/abrt-action-print
%files plugin-mailx
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/Mailx.conf
%{_libdir}/%{name}/Mailx.glade
%{_mandir}/man7/abrt-Mailx.7.gz
-%{_libexecdir}/abrt-action-mailx
+%{_bindir}/abrt-action-mailx
%files plugin-bugzilla
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/Bugzilla.conf
%{_libdir}/%{name}/Bugzilla.glade
%{_mandir}/man7/abrt-Bugzilla.7.gz
-%{_libexecdir}/abrt-action-bugzilla
+%{_bindir}/abrt-action-bugzilla
%files plugin-rhtsupport
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/RHTSupport.conf
%{_libdir}/%{name}/RHTSupport.glade
# {_mandir}/man7/abrt-RHTSupport.7.gz
-%{_libexecdir}/abrt-action-rhtsupport
+%{_bindir}/abrt-action-rhtsupport
%files plugin-reportuploader
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/Upload.conf
%{_libdir}/%{name}/Upload.glade
%{_mandir}/man7/abrt-Upload.7.gz
-%{_libexecdir}/abrt-action-upload
+%{_bindir}/abrt-action-upload
%files addon-python
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/plugins/Python.conf
-%{_libexecdir}/abrt-action-analyze-python
+%{_bindir}/abrt-action-analyze-python
%{python_site}/*.py*
%{python_site}/abrt.pth
diff -x '*.po' -d -urpN abrt.1/src/daemon/abrt_event.conf abrt.2/src/daemon/abrt_event.conf
--- abrt.1/src/daemon/abrt_event.conf 2010-12-22 16:33:47.000000000 +0100
+++ abrt.2/src/daemon/abrt_event.conf 2011-01-04 13:08:25.685130919 +0100
@@ -52,7 +52,7 @@ EVENT=analyze analyzer=CCpp backtrace=
# Same as "analyze", but executed when user requests "refresh" in GUI
#EVENT=reanalyze analyzer=CCpp trim-debuginfo-cache /var/cache/abrt-di 4096m
EVENT=reanalyze analyzer=CCpp abrt-action-install-debuginfo.py "--core=$DUMP_DIR/coredump" "--tmpdir=/var/run/abrt/$$-$RANDOM" --cache=/var/cache/abrt-di
-EVENT=reanalyze analyzer=CCpp abrt-action-generate-backtrace
+EVENT=reanalyze analyzer=CCpp abrt-action-generate-backtrace
EVENT=report analyzer=Kerneloops abrt-action-kerneloops
EVENT=report_Bugzilla analyzer=CCpp abrt-action-bugzilla -c /etc/abrt/plugins/Bugzilla.conf
diff -x '*.po' -d -urpN abrt.1/src/daemon/abrt-handle-crashdump.c abrt.2/src/daemon/abrt-handle-crashdump.c
--- abrt.1/src/daemon/abrt-handle-crashdump.c 2010-12-22 16:33:47.000000000 +0100
+++ abrt.2/src/daemon/abrt-handle-crashdump.c 2011-01-04 13:02:15.604880597 +0100
@@ -87,13 +87,6 @@ int main(int argc, char **argv)
/* -e EVENT: run event */
- /* Need to add LIBEXEC_DIR to PATH, because otherwise abrt-action-*
- * are not found by exec()
- */
- const char *env_path = getenv("PATH");
- if (!env_path) env_path = "";
- putenv(xasprintf("PATH=%s%s%s", LIBEXEC_DIR, (!env_path[0] ? "" : ":"), env_path));
-
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 ? dump_dir_name : ".", event);
diff -x '*.po' -d -urpN abrt.1/src/daemon/Daemon.cpp abrt.2/src/daemon/Daemon.cpp
--- abrt.1/src/daemon/Daemon.cpp 2010-12-22 16:33:47.000000000 +0100
+++ abrt.2/src/daemon/Daemon.cpp 2011-01-04 13:03:42.003131574 +0100
@@ -726,13 +726,9 @@ int main(int argc, char** argv)
* (I saw it set only DBUS_STARTER_ADDRESS and DBUS_STARTER_BUS_TYPE).
* In this case, set something sane:
*/
- /* Need to add LIBEXEC_DIR to PATH, because otherwise abrt-action-*
- * are not found by exec()
- */
const char *env_path = getenv("PATH");
if (!env_path || !env_path[0])
- env_path = "/usr/sbin:/usr/bin:/sbin:/bin";
- putenv(xasprintf("PATH=%s:%s", LIBEXEC_DIR, env_path));
+ putenv((char*)"PATH=/usr/sbin:/usr/bin:/sbin:/bin");
putenv(xasprintf("ABRT_VERBOSE=%u", g_verbose));
diff -x '*.po' -d -urpN abrt.1/src/daemon/Makefile.am abrt.2/src/daemon/Makefile.am
--- abrt.1/src/daemon/Makefile.am 2010-12-22 16:33:47.000000000 +0100
+++ abrt.2/src/daemon/Makefile.am 2011-01-04 13:04:37.394130947 +0100
@@ -1,12 +1,12 @@
bin_SCRIPTS = \
abrt-handle-upload
-libexec_PROGRAMS = \
- abrt-action-save-package-data
bin_PROGRAMS = \
- abrt-handle-crashdump
+ abrt-handle-crashdump \
+ abrt-action-save-package-data
-sbin_PROGRAMS = abrtd \
+sbin_PROGRAMS = \
+ abrtd \
abrt-server
abrtd_SOURCES = \
diff -x '*.po' -d -urpN abrt.1/src/hooks/Makefile.am abrt.2/src/hooks/Makefile.am
--- abrt.1/src/hooks/Makefile.am 2010-12-22 16:33:47.000000000 +0100
+++ abrt.2/src/hooks/Makefile.am 2011-01-04 13:05:40.345882960 +0100
@@ -1,4 +1,5 @@
libexec_PROGRAMS = abrt-hook-ccpp
+
bin_PROGRAMS = dumpoops
# abrt-hook-ccpp
diff -x '*.po' -d -urpN abrt.1/src/plugins/Makefile.am abrt.2/src/plugins/Makefile.am
--- abrt.1/src/plugins/Makefile.am 2010-12-22 16:33:47.000000000 +0100
+++ abrt.2/src/plugins/Makefile.am 2011-01-04 13:05:34.139130764 +0100
@@ -1,8 +1,20 @@
pluginslibdir = $(PLUGINS_LIB_DIR)
-libexec_SCRIPTS = \
+bin_SCRIPTS = \
abrt-action-install-debuginfo.py
+bin_PROGRAMS = \
+ abrt-action-analyze-c \
+ abrt-action-analyze-python \
+ abrt-action-analyze-oops \
+ abrt-action-generate-backtrace \
+ abrt-action-bugzilla \
+ abrt-action-rhtsupport \
+ abrt-action-kerneloops \
+ abrt-action-upload \
+ abrt-action-mailx \
+ abrt-action-print
+
pluginslib_LTLIBRARIES = \
libCCpp.la \
libKerneloopsScanner.la
@@ -78,18 +90,6 @@ libKerneloopsScanner_la_LDFLAGS = \
-avoid-version \
$(GLIB_LIBS)
-libexec_PROGRAMS = \
- abrt-action-analyze-c \
- abrt-action-analyze-python \
- abrt-action-analyze-oops \
- abrt-action-generate-backtrace \
- abrt-action-bugzilla \
- abrt-action-rhtsupport \
- abrt-action-kerneloops \
- abrt-action-upload \
- abrt-action-mailx \
- abrt-action-print
-
abrt_action_analyze_c_SOURCES = \
abrt-action-analyze-c.c
abrt_action_analyze_c_CPPFLAGS = \
diff -x '*.po' -d -urpN abrt.1/src/report-python/test_setroubleshoot_example2 abrt.2/src/report-python/test_setroubleshoot_example2
--- abrt.1/src/report-python/test_setroubleshoot_example2 1970-01-01 01:00:00.000000000 +0100
+++ abrt.2/src/report-python/test_setroubleshoot_example2 2011-01-04 13:41:39.599543448 +0100
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import report
+import report.io
+import report.io.GTKIO
+import report.accountmanager
+
+accounts = report.accountmanager.AccountManager()
+
+signature = report.createAlertSignature("selinux-policy",
+ "setroubleshoot",
+ "self.siginfo.get_hash()",
+ "self.summary",
+ "content")
+
+# Won't send log anywhere:
+#rc = report.report(signature, report.io.GTKIO.GTKIO(accounts))
+
+# report.report() + logging:
+def logging_callback(line):
+ print "LOG:", line
+ return
+state = report.run_event_state()
+state.logging_callback = logging_callback
+rc = state.run_event_on_crash_data(signature, "report")
+
+print "rc:", rc
13 years, 3 months
gdbserver for core files
by Jan Kratochvil
Hi,
with the proposal:
https://fedoraproject.org/wiki/Features/RetraceServer
and its core files upload feature I tried to provide a gdbserver interface for
the core files instead as the upload can be slow. FSF gdbserver cannot load
core files so created a simple new gdbserver for it:
git://git.fedorahosted.org/git/elfutils.git
branch: jankratochvil/gdbserver
src/gdbserver.c
* Currently threading is not supported.
* Currently only x86_64 is supported (the NOTE registers layout).
In my current setup of:
* link RTT (round trip time): 272ms
* uplink speed: 1Mbit
* core file from openoffice.org: 74M
* core file from openoffice.org xz -9e: 8.6M
I get:
1m35.685s: scp upload.
1m31.144s: gdbserver with gdb LINE_SIZE_POWER == 12 (0x1000).
3m55.867s: gdbserver with gdb default LINE_SIZE_POWER == 6 ( 0x40).
Just I guess usually people have lower RTT and lower uplink, don't they?
In such case the results would be much more in the favor of gdbserver.
Still in none of the cases it completes in 60 seconds after which you kill
current GDB. So you are going to be killing even the upload processes.
I can finish the two missing features if there is an interest in it.
Thanks,
Jan
13 years, 3 months
[PATCH] abrt_11x branch: pass old pattern to ccpp hook and use it
by Denys Vlasenko
abrtd:
instead of
"|/usr/libexec/abrt-ccpp-hook DEBUG_DUMPS_DIR %p %s %u %c",
sets coredump handler to
"|/usr/libexec/abrt-ccpp-hook DEBUG_DUMPS_DIR %s %c %p %u %g %t %h %e OLD_PATTERN"
abrt-ccpp-hook:
expands OLD_PATTERN using values of %s %c %p %u %g %t %h %e
and uses it as a name of "compat coredump".
Patch has a feature which prevents usage of kernel-truncated
OLD_PATTERN: it is passed as hex string *with terminating NUL*
(encoded as 00). If ccpp hook doesn't see 00, it refuses to use
OLD_PATTERN and uses string "core" instead.
Run tested. On a new kernel, allows to pass up to 27 char long
old pattern. Longer patterns are still truncated.
This may be improved in future kernels.
Please review.
--
vda
diff -x '*.po' -d -urpN abrt.0/inc/abrtlib.h abrt.1/inc/abrtlib.h
--- abrt.0/inc/abrtlib.h 2011-01-06 13:10:44.000000000 +0100
+++ abrt.1/inc/abrtlib.h 2011-01-06 13:15:57.000000000 +0100
@@ -218,6 +218,17 @@ char* xmalloc_sockaddr2dotted_noport(con
/* Random utility functions */
+#ifdef __cplusplus
+extern "C" {
+#endif
+/* Emit a string of hex representation of bytes */
+char* bin2hex(char *dst, const char *str, int count);
+/* Convert "xxxxxxxx" hex string to binary, no more than COUNT bytes */
+char* hex2bin(char *dst, const char *str, int count);
+#ifdef __cplusplus
+}
+#endif
+
/* Returns command line of running program.
* Caller is responsible to free() the returned value.
* If the pid is not valid or command line can not be obtained,
diff -x '*.po' -d -urpN abrt.0/lib/Plugins/CCpp.cpp abrt.1/lib/Plugins/CCpp.cpp
--- abrt.0/lib/Plugins/CCpp.cpp 2010-11-22 14:49:46.000000000 +0100
+++ abrt.1/lib/Plugins/CCpp.cpp 2011-01-06 15:20:04.803436707 +0100
@@ -39,15 +39,27 @@
using namespace std;
#define CORE_PATTERN_IFACE "/proc/sys/kernel/core_pattern"
-#define CORE_PATTERN "|"CCPP_HOOK_PATH" "DEBUG_DUMPS_DIR" %p %s %u %c"
+/*
+ * %s - signal number
+ * %c - ulimit -c value
+ * %p - pid
+ * %u - uid
+ * %g - gid
+ * %t - UNIX time of dump
+ * %h - hostname
+ * %e - executable filename
+ * %% - output one "%"
+ */
+#define CORE_PATTERN "|"CCPP_HOOK_PATH" "DEBUG_DUMPS_DIR" %s %c %p %u %g %t %h %e"
+
#define CORE_PIPE_LIMIT_IFACE "/proc/sys/kernel/core_pipe_limit"
/* core_pipe_limit specifies how many dump_helpers might run at the same time
-0 - means unlimited, but the it's not guaranteed that /proc/<pid> of crashing
-process might not be available for dump_helper
-4 - means that 4 dump_helpers can run at the same time, which should be enough
-for ABRT, we can miss some crashes, but what are the odds that more processes
-crash at the same time? This value has been recommended by nhorman
-*/
+ * 0 - means unlimited, but the it's not guaranteed that /proc/<pid>
+ * of crashing process will be available for dump_helper
+ * 4 - means that 4 dump_helpers can run at the same time, which should be enough
+ * for ABRT, we can miss some crashes, but what are the odds that more processes
+ * crash at the same time? This value has been recommended by nhorman
+ */
#define CORE_PIPE_LIMIT "4"
#define DEBUGINFO_CACHE_DIR LOCALSTATEDIR"/cache/abrt-di"
@@ -796,7 +808,7 @@ void CAnalyzerCCpp::Init()
}
if (m_sOldCorePattern[0] == '|')
{
- if (m_sOldCorePattern == CORE_PATTERN)
+ if (strncmp(m_sOldCorePattern.c_str(), CORE_PATTERN, strlen(CORE_PATTERN)) == 0)
{
log("warning: %s already contains %s, "
"did abrt daemon crash recently?",
@@ -820,14 +832,35 @@ void CAnalyzerCCpp::Init()
fp = fopen(CORE_PATTERN_IFACE, "w");
if (fp)
{
- fputs(CORE_PATTERN, fp);
+ if (m_sOldCorePattern[0] != '|')
+ {
+ const char *old = m_sOldCorePattern.c_str();
+ unsigned len = strchrnul(old, '\n') - old;
+ char *hex_old = (char*)xmalloc(len * 2 + 1);
+ bin2hex(hex_old, old, len)[0] = '\0';
+ /* Trailing 00 is a sentinel. Decoder in the hook will check it.
+ * If it won't see it, then kernel has truncated the argument:
+ */
+ char *pattern = xasprintf("%s %s00", CORE_PATTERN, hex_old);
+ //log("old:'%s'->'%s'", old, hex_old);
+ //log("pattern:'%s'", pattern);
+
+ fputs(pattern, fp);
+
+ free(pattern);
+ free(hex_old);
+ }
+ else
+ {
+ fputs(CORE_PATTERN, fp);
+ }
fclose(fp);
}
/* read the core_pipe_limit and change it if it's == 0
- otherwise the abrt-hook-ccpp won't be able to read /proc/<pid>
- of the crashing process
- */
+ * otherwise the abrt-hook-ccpp won't be able to read /proc/<pid>
+ * of the crashing process
+ */
fp = fopen(CORE_PIPE_LIMIT_IFACE, "r");
if (fp)
{
diff -x '*.po' -d -urpN abrt.0/lib/Utils/binhex.cpp abrt.1/lib/Utils/binhex.cpp
--- abrt.0/lib/Utils/binhex.cpp 1970-01-01 01:00:00.000000000 +0100
+++ abrt.1/lib/Utils/binhex.cpp 2011-01-06 13:11:53.000000000 +0100
@@ -0,0 +1,74 @@
+/*
+ Copyright (C) 2010 ABRT team
+ Copyright (C) 2010 RedHat Inc
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+
+static const char hexdigits_locase[] = "0123456789abcdef";
+
+/* Emit a string of hex representation of bytes */
+char *bin2hex(char *dst, const char *str, int count)
+{
+ while (count) {
+ unsigned char c = *str++;
+ /* put lowercase hex digits */
+ *dst++ = hexdigits_locase[c >> 4];
+ *dst++ = hexdigits_locase[c & 0xf];
+ count--;
+ }
+ return dst;
+}
+
+/* Convert "xxxxxxxx" hex string to binary, no more than COUNT bytes */
+char *hex2bin(char *dst, const char *str, int count)
+{
+ /* Parts commented out with // allow parsing
+ * of strings like "xx:x:x:xx:xx:xx:xxxxxx"
+ * (IPv6, ethernet addresses and the like).
+ */
+ errno = EINVAL;
+ while (*str && count) {
+ uint8_t val;
+ uint8_t c;
+
+ c = *str++;
+ if (isdigit(c))
+ val = c - '0';
+ else if ((c|0x20) >= 'a' && (c|0x20) <= 'f')
+ val = (c|0x20) - ('a' - 10);
+ else
+ return NULL;
+ val <<= 4;
+ c = *str;
+ if (isdigit(c))
+ val |= c - '0';
+ else if ((c|0x20) >= 'a' && (c|0x20) <= 'f')
+ val |= (c|0x20) - ('a' - 10);
+ //else if (c == ':' || c == '\0')
+ // val >>= 4;
+ else
+ return NULL;
+
+ *dst++ = val;
+ //if (c != '\0')
+ str++;
+ //if (*str == ':')
+ // str++;
+ count--;
+ }
+ errno = (*str ? ERANGE : 0);
+ return dst;
+}
diff -x '*.po' -d -urpN abrt.0/lib/Utils/Makefile.am abrt.1/lib/Utils/Makefile.am
--- abrt.0/lib/Utils/Makefile.am 2011-01-06 13:10:44.000000000 +0100
+++ abrt.1/lib/Utils/Makefile.am 2011-01-06 13:19:29.000000000 +0100
@@ -12,6 +12,7 @@ AM_YFLAGS = --verbose
libABRTUtils_la_SOURCES = \
xfuncs.cpp \
encbase64.cpp \
+ binhex.cpp \
stdio_helpers.cpp \
read_write.cpp \
logging.cpp \
diff -x '*.po' -d -urpN abrt.0/src/Hooks/abrt-hook-ccpp.cpp abrt.1/src/Hooks/abrt-hook-ccpp.cpp
--- abrt.0/src/Hooks/abrt-hook-ccpp.cpp 2010-11-22 14:49:46.000000000 +0100
+++ abrt.1/src/Hooks/abrt-hook-ccpp.cpp 2011-01-06 15:24:14.421186221 +0100
@@ -166,9 +166,22 @@ static char* get_cwd(pid_t pid)
return malloc_readlink(buf);
}
-static char core_basename[sizeof("core.%lu") + sizeof(long)*3] = "core";
+/*
+ * %s - signal number
+ * %c - ulimit -c value
+ * %p - pid
+ * %u - uid
+ * %g - gid
+ * %t - UNIX time of dump
+ * %h - hostname
+ * %e - executable filename
+ * %% - output one "%"
+ */
+/* Must match CORE_PATTERN order in daemon! */
+static const char percent_specifiers[] = "%scpugthe";
+static char *core_basename = "core";
-static int open_user_core(const char *user_pwd, uid_t uid, pid_t pid)
+static int open_user_core(const char *user_pwd, uid_t uid, pid_t pid, char **percent_values)
{
struct passwd* pw = getpwuid(uid);
gid_t gid = pw ? pw->pw_gid : uid;
@@ -183,20 +196,63 @@ static int open_user_core(const char *us
return -1;
}
- /* Mimic "core.PID" if requested */
- char buf[] = "0\n";
- int fd = open("/proc/sys/kernel/core_uses_pid", O_RDONLY);
- if (fd >= 0)
+ if (strcmp(core_basename, "core") == 0)
{
- read(fd, buf, sizeof(buf));
- close(fd);
+ /* Mimic "core.PID" if requested */
+ char buf[] = "0\n";
+ int fd = open("/proc/sys/kernel/core_uses_pid", O_RDONLY);
+ if (fd >= 0)
+ {
+ read(fd, buf, sizeof(buf));
+ close(fd);
+ }
+ if (strcmp(buf, "1\n") == 0)
+ {
+ core_basename = xasprintf("%s.%lu", core_basename, (long)pid);
+ }
}
- if (strcmp(buf, "1\n") == 0)
+ else
{
- sprintf(core_basename, "core.%lu", (long)pid);
+ /* Expand old core pattern, put expanded name in core_basename */
+ core_basename = xstrdup(core_basename);
+ unsigned idx = 0;
+ while (1)
+ {
+ char c = core_basename[idx];
+ if (!c)
+ break;
+ idx++;
+ if (c != '%')
+ continue;
+
+ /* We just copied %, look at following char and expand %c */
+ c = core_basename[idx];
+ unsigned specifier_num = strchrnul(percent_specifiers, c) - percent_specifiers;
+ if (percent_specifiers[specifier_num] != '\0') /* valid %c (might be %% too) */
+ {
+ const char *val = "%";
+ if (specifier_num > 0) /* not %% */
+ val = percent_values[specifier_num - 1];
+ //log("c:'%c'", c);
+ //log("val:'%s'", val);
+
+ /* Replace %c at core_basename[idx] by its value */
+ idx--;
+ char *old = core_basename;
+ core_basename = xasprintf("%.*s%s%s", idx, core_basename, val, core_basename + idx + 2);
+ //log("pos:'%*s|'", idx, "");
+ //log("new:'%s'", core_basename);
+ //log("old:'%s'", old);
+ free(old);
+ idx += strlen(val);
+ }
+ /* else: invalid %c, % is already copied verbatim,
+ * next loop iteration will copy c */
+ }
}
- /* man core:
+ /* Open (create) compat core file.
+ * man core:
* There are various circumstances in which a core dump file
* is not produced:
*
@@ -214,8 +270,7 @@ static int open_user_core(const char *us
*
* The RLIMIT_CORE or RLIMIT_FSIZE resource limits for the process
* are set to zero.
- * [shouldn't it be checked by kernel? 2.6.30.9-96 doesn't, still
- * calls us even if "ulimit -c 0"]
+ * [we check RLIMIT_CORE, but how can we check RLIMIT_FSIZE?]
*
* The binary being executed by the process does not have
* read permission enabled. [how we can check it here?]
@@ -226,7 +281,6 @@ static int open_user_core(const char *us
* (However, see the description of the prctl(2) PR_SET_DUMPABLE operation,
* and the description of the /proc/sys/fs/suid_dumpable file in proc(5).)
*/
-
/* Do not O_TRUNC: if later checks fail, we do not want to have file already modified here */
struct stat sb;
errno = 0;
@@ -245,6 +299,7 @@ static int open_user_core(const char *us
if (ftruncate(user_core_fd, 0) != 0) {
/* perror first, otherwise unlink may trash errno */
perror_msg("truncate %s/%s", user_pwd, core_basename);
+ unlink(core_basename);
return -1;
}
@@ -253,23 +308,28 @@ static int open_user_core(const char *us
int main(int argc, char** argv)
{
- int i;
struct stat sb;
- if (argc < 5)
+ if (argc < 10) /* no argv[9]? */
{
- error_msg_and_die("Usage: %s: DUMPDIR PID SIGNO UID CORE_SIZE_LIMIT", argv[0]);
+ /* percent specifier: %s %c %p %u %g %t %h %e */
+ /* argv: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] */
+ error_msg_and_die("Usage: %s DUMPDIR SIGNO CORE_SIZE_LIMIT PID UID GID TIME HOSTNAME BINARY_NAME [OLD_PATTERN]", argv[0]);
}
/* Not needed on 2.6.30.
* At least 2.6.18 has a bug where
- * argv[1] = "DUMPDIR PID SIGNO UID CORE_SIZE_LIMIT"
- * argv[2] = "PID SIGNO UID CORE_SIZE_LIMIT"
+ * argv[1] = "DUMPDIR SIGNO CORE_SIZE_LIMIT ..."
+ * argv[2] = "SIGNO CORE_SIZE_LIMIT ..."
* and so on. Fixing it:
*/
- for (i = 1; argv[i]; i++)
+ if (strchr(argv[1], ' '))
{
- strchrnul(argv[i], ' ')[0] = '\0';
+ int i;
+ for (i = 1; argv[i]; i++)
+ {
+ strchrnul(argv[i], ' ')[0] = '\0';
+ }
}
openlog("abrt", LOG_PID, LOG_DAEMON);
@@ -277,19 +337,38 @@ int main(int argc, char** argv)
errno = 0;
const char* dddir = argv[1];
- pid_t pid = xatoi_u(argv[2]);
- const char* signal_str = argv[3];
- int signal_no = xatoi_u(argv[3]);
- uid_t uid = xatoi_u(argv[4]);
- off_t ulimit_c = strtoull(argv[5], NULL, 10);
+ const char* signal_str = argv[2];
+ int signal_no = xatoi_u(signal_str);
+ off_t ulimit_c = strtoull(argv[3], NULL, 10);
if (ulimit_c < 0) /* unlimited? */
{
/* set to max possible >0 value */
ulimit_c = ~((off_t)1 << (sizeof(off_t)*8-1));
}
+ pid_t pid = xatoi_u(argv[4]);
+ uid_t uid = xatoi_u(argv[5]);
if (errno || pid <= 0)
{
- error_msg_and_die("pid '%s' or limit '%s' is bogus", argv[2], argv[5]);
+ perror_msg_and_die("pid '%s' or limit '%s' is bogus", argv[4], argv[3]);
+ }
+ if (argv[10]) /* OLD_PATTERN */
+ {
+ char *buf = (char*) xzalloc(strlen(argv[10]) / 2 + 2);
+ char *end = hex2bin(buf, argv[10], strlen(argv[10]));
+ if (end && end > buf && end[-1] == '\0')
+ {
+ core_basename = buf;
+ //log("core_basename:'%s'", core_basename);
+ }
+ else
+ {
+ /* Until recently, kernels were truncating expanded core pattern.
+ * In this case, we end up here...
+ */
+ error_msg("bad old pattern '%s', ignoring and using 'core'", argv[10]);
+ /* core_basename = "core"; - already is */
+ free(buf);
+ }
}
int src_fd_binary;
@@ -316,8 +395,8 @@ int main(int argc, char** argv)
/* Open a fd to compat coredump, if requested and is possible */
int user_core_fd = -1;
if (setting_MakeCompatCore && ulimit_c != 0)
- /* note: checks "user_pwd == NULL" inside */
- user_core_fd = open_user_core(user_pwd, uid, pid);
+ /* note: checks "user_pwd == NULL" inside, updates core_basename */
+ user_core_fd = open_user_core(user_pwd, uid, pid, &argv[2]);
if (executable == NULL)
{
13 years, 3 months
brand new bugzilla report structure
by Nikola Pajkovsky
I'd like to propose a few changes about bugzilla report structure. It's
horribly ugly!
First item will be an inline comment.
How to reproduce (title)
(new-line/nothing/----- separator) I'm not sure what will be look better
....
....
....
Backtrace
(separator or nothing here)
...
...
...
Additional information
(separator or nothing here)
path-to-dump-dir
command-line
executable
kernel
abrt-ver
And that's it. Arch, program version, release version and the others are in
summary or filled in bug.
What do you think?
--
Nikola
13 years, 3 months
[PATCH 1/4] dump_dir: return unknown files
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/include/abrt_crash_dump.h | 1 +
src/include/report/dump_dir.h | 1 +
src/lib/crash_dump.c | 31 +++++++++++++++++++++++++++++++
src/lib/dump_dir.c | 41 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/src/include/abrt_crash_dump.h b/src/include/abrt_crash_dump.h
index 9ecbf56..aa62000 100644
--- a/src/include/abrt_crash_dump.h
+++ b/src/include/abrt_crash_dump.h
@@ -70,6 +70,7 @@
// (a string with "\n" terminated event names)
#define CD_EVENTS "Events"
+extern const char *abrt_known_files[];
#ifdef __cplusplus
extern "C" {
diff --git a/src/include/report/dump_dir.h b/src/include/report/dump_dir.h
index bf3b120..913eca1 100644
--- a/src/include/report/dump_dir.h
+++ b/src/include/report/dump_dir.h
@@ -58,6 +58,7 @@ char* dd_load_text(const struct dump_dir *dd, const char *name);
void dd_save_text(struct dump_dir *dd, const char *name, const char *data);
void dd_save_binary(struct dump_dir *dd, const char *name, const char *data, unsigned size);
void dd_delete(struct dump_dir *dd);
+char **dd_get_unknown_files(struct dump_dir *dd, const char **known_files);
void delete_dump_dir(const char *dd_dir);
diff --git a/src/lib/crash_dump.c b/src/lib/crash_dump.c
index 189ec9c..c7f44e5 100644
--- a/src/lib/crash_dump.c
+++ b/src/lib/crash_dump.c
@@ -19,6 +19,37 @@
#include "abrtlib.h"
#include "abrt_crash_dump.h"
+const char *abrt_known_files[] = {
+ FILENAME_ANALYZER ,
+ FILENAME_EXECUTABLE ,
+ FILENAME_BINARY ,
+ FILENAME_CMDLINE ,
+ FILENAME_REASON ,
+ FILENAME_COREDUMP ,
+ FILENAME_MEMORYMAP ,
+ FILENAME_DUPHASH ,
+ FILENAME_CRASH_FUNCTION ,
+ FILENAME_ARCHITECTURE ,
+ FILENAME_KERNEL ,
+ FILENAME_TIME ,
+ FILENAME_RELEASE ,
+ FILENAME_PACKAGE ,
+ FILENAME_COMPONENT ,
+ FILENAME_DESCRIPTION ,
+ FILENAME_COMMENT ,
+ FILENAME_REPRODUCE ,
+ FILENAME_RATING ,
+ FILENAME_HOSTNAME ,
+ FILENAME_REMOTE ,
+ FILENAME_TAINTED ,
+ FILENAME_UID ,
+ FILENAME_UUID ,
+ FILENAME_INFORMALL ,
+ FILENAME_COUNT ,
+ FILENAME_MESSAGE ,
+ NULL
+};
+
static void free_crash_item(void *ptr)
{
if (ptr)
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
index 8e1744a..0e0b5f1 100644
--- a/src/lib/dump_dir.c
+++ b/src/lib/dump_dir.c
@@ -503,6 +503,47 @@ int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name)
return 0;
}
+/*
+ * return list of unknown files in dump directory
+ */
+char **dd_get_unknown_files(struct dump_dir *dd, const char **known_files)
+{
+ if (!dd->locked)
+ error_msg_and_die("dump_dir is not opened"); /* bug */
+
+ char *short_name = NULL;
+ unsigned size = 16;
+ unsigned idx = 0;
+ char **unknowns = xzalloc(sizeof(char*) * size);
+
+ dd_init_next_file(dd);
+ while (dd_get_next_file(dd, &short_name, NULL))
+ {
+ if (idx + 1 >= size)
+ {
+ size *= 2;
+ unknowns = xrealloc(unknowns, sizeof(char*) * size);
+ }
+
+ const char *const *v = known_files;
+ while (*v)
+ {
+ if (strcmp(*v, short_name) == 0)
+ break;
+ v++;
+ }
+
+ if (*v)
+ continue;
+
+ unknowns[idx++] = short_name;
+ }
+
+ unknowns[idx] = NULL;
+
+ return unknowns;
+}
+
/* Utility function */
void delete_dump_dir(const char *dd_dir)
{
--
1.7.3.3.489.g44430
13 years, 3 months
[PATCH] 666893 - Unable to make sense of XML-RPC response from server
by Nikola Pajkovsky
By default, XML data from the network may be no larger than 512K.
We have a bug which is 733402 bytes long. Limit is now 2 * 512K.
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
lib/Utils/abrt_xmlrpc.cpp | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/lib/Utils/abrt_xmlrpc.cpp b/lib/Utils/abrt_xmlrpc.cpp
index ac2654e..4ae772f 100644
--- a/lib/Utils/abrt_xmlrpc.cpp
+++ b/lib/Utils/abrt_xmlrpc.cpp
@@ -52,6 +52,15 @@ void abrt_xmlrpc_conn::new_xmlrpc_client(const char* url, bool ssl_verify)
* We do it in abrtd's main */
/* xmlrpc_client_setup_global_const(&env); */
+ /* Bug related #666893 - Unable to make sense of XML-RPC response from server
+ * By default, XML data from the network may be no larger than 512K.
+ * Some client and server modules may fail to enforce this properly.
+ * #define XMLRPC_XML_SIZE_LIMIT_DEFAULT (512*1024)
+ *
+ * bug is long 733402 bytes for now, hope it will be enought
+ */
+ xmlrpc_limit_set(XMLRPC_XML_SIZE_LIMIT_ID, 2 * XMLRPC_XML_SIZE_LIMIT_DEFAULT);
+
struct xmlrpc_curl_xportparms curlParms;
memset(&curlParms, 0, sizeof(curlParms));
/* curlParms.network_interface = NULL; - done by memset */
--
1.7.4.rc0
13 years, 3 months
[PATCH] 665405 - ABRT's usage of sos does not grab /var/log/messages
by Nikola Pajkovsky
add --only=general --only=x11
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
lib/Plugins/SOSreport.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/Plugins/SOSreport.cpp b/lib/Plugins/SOSreport.cpp
index 6c8ab1f..14b4cad 100644
--- a/lib/Plugins/SOSreport.cpp
+++ b/lib/Plugins/SOSreport.cpp
@@ -69,7 +69,7 @@ void CActionSOSreport::Run(const char *pActionDir, const char *pArgs, int force)
" --only=devicemapper --only=filesys --only=hardware --only=kernel"
" --only=libraries --only=memory --only=networking --only=nfsserver"
" --only=pam --only=process --only=rpm -k rpm.rpmva=off --only=ssh"
- " --only=startup --only=yum 2>&1;"
+ " --only=startup --only=yum --only=general --only=x11 2>&1;"
"rm sosreport*.md5 2>/dev/null;"
"mv sosreport*.tar.bz2 sosreport.tar.bz2 2>/dev/null;"
"mv sosreport*.tar.xz sosreport.tar.xz 2>/dev/null;"
--
1.7.4.rc0
13 years, 3 months