Re: rasdaemon and abrt cooperation
by Denys Vlasenko
On 06/05/2013 03:25 PM, Petr Holasek wrote:
> Hi Denys,
>
> I have some ideas about rasdaemon abrt hook
> and also following questions.
>
> Feel free to stop by or ping me, when you'll
> be in office, I'll be there till ~6PM today
> and afternoon tomorrow.
Currently we use Unix domain socket at
/var/run/abrt/abrt.socket
to support creation of problem data from crashing python
applications.
The socket accepts the following HTTP requests:
DELETE <problem_dir> HTTP/1.1
PUT / HTTP/1.1
DELETE request is straightforward, and anyway, you don't need it.
PUT request has the following form:
PUT / HTTP/1.1<CR><LF>
headers<CR><LF>
<CR><LF>
name1=value1<NUL>name2=value2<NUL>...
It appears that we misunderstood HTTP protocol and we should
have used POST instead of PUT. I am going to add POST alias
which works the same as PUT, and remove PUT sometime in the future.
For now, use PUT. The URI in PUT should be just /.
The headers following PUT line are currently ignored.
The body is NUL-delimited (not newline delimited!) set
of name-value pairs which describe the problem.
You can use any names which make sense for your problem
(for example, if someone is reporting an out-of-paper
problem with a printer, sending "printer_name=FOO" would make sense).
Some names *have* to be in the problem:
type=
reason=
"type" describes what kind of the problem it is. Say, "Python"
is used by python crashes. You need to invent your own identifier(s)
for the problems you want to report. Say, "mem_error" for ECC/cache
errors, "bus_error" for PCI errors?
This field is used to differentiate abrt's response to a problem.
We don't want ECC errors reported to Bugzilla, right? :)
"reason" is a short, one-line, human-readable description of the problem,
suitable, for example, for showing in the list of problems. Examples
we currently see or use:
"<module>:ZeroDivisionError: integer division or modulo by zero"
"Segmentation fault at address 0x7ff6bf09e010"
"Process %s was killed by signal %s"
time=<unixtime in seconds> will be added automatically unless you supply it.
I looked thru the list of names we use and many don't make sense for you
(say, "uid" makes no sense for ECC errors :), but the following ones
may be useful:
architecture=<uname.machine>
comment=<long, multi-line description of the problem (if "reason" isn't enough)>
kernel=<kernel version>
cmdline=<kernel cmdline>
As I said, if you have more data to report, create your own name=value pair
to be saved.
Server will respond with
HTTP/1.1 <http_code> <CR><LF>
<CR><LF>
http_code will be 201 ("Created") on success.
Do you think you can use this interface from rasdaemon?
--
vda
10 years, 7 months
[ABRT PATCH 1/2] provide tmpfiles.d configuration
by Jakub Filak
Related to #660
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
Makefile.am | 3 +++
init-scripts/abrt.conf | 3 +++
2 files changed, 6 insertions(+)
create mode 100644 init-scripts/abrt.conf
diff --git a/Makefile.am b/Makefile.am
index b56a954..c1596f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,6 +41,9 @@ if HAVE_SYSTEMD
init-scripts/abrt-xorg.service \
init-scripts/abrt-vmcore.service \
init-scripts/abrt-uefioops.service
+
+ systemdtmpfilesdir = $(prefix)/lib/tmpfiles.d
+ systemdtmpfiles_DATA = init-scripts/abrt.conf
else
sysv_initdir = $(sysconfdir)/rc.d/init.d/
sysv_init_SCRIPTS = init-scripts/abrtd \
diff --git a/init-scripts/abrt.conf b/init-scripts/abrt.conf
new file mode 100644
index 0000000..73cd9d7
--- /dev/null
+++ b/init-scripts/abrt.conf
@@ -0,0 +1,3 @@
+#Type Path Mode UID GID
+d /var/tmp/abrt 0755 abrt abrt
+x /var/tmp/abrt/*
--
1.8.3.1
10 years, 7 months
[PATCH] added checks for locked dump directory to dd_* functions, closes #133 Signed-off-by: Petr Kubat <pkubat@redhat.com>
by Petr Kubat
---
src/lib/dump_dir.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
index c1037b3..c3f5c57 100644
--- a/src/lib/dump_dir.c
+++ b/src/lib/dump_dir.c
@@ -811,6 +811,12 @@ static int delete_file_dir(const char *dir, bool skip_lock_file)
int dd_delete(struct dump_dir *dd)
{
+ if (!dd->locked)
+ {
+ error_msg("dump_dir is not locked for writing");
+ return -1;
+ }
+
int r = delete_file_dir(dd->dd_dirname, /*skip_lock_file:*/ true);
dd->locked = 0; /* delete_file_dir already removed .lock */
dd_close(dd);
@@ -1214,6 +1220,12 @@ report_result_t *find_in_reported_to(struct dump_dir *dd, const char *prefix)
int dd_rename(struct dump_dir *dd, const char *new_path)
{
+ if (!dd->locked)
+ {
+ error_msg("dump_dir is not locked for writing");
+ return -1;
+ }
+
int res = rename(dd->dd_dirname, new_path);
if (res == 0)
{
@@ -1221,6 +1233,7 @@ int dd_rename(struct dump_dir *dd, const char *new_path)
dd->dd_dirname = rm_trailing_slashes(new_path);
}
return res;
+
}
/* Utility function */
--
1.8.3.1
10 years, 7 months
[ABRT PATCH] abrt-cli list: don't print @N thing. rhbz#906733
by Denys Vlasenko
Once upon a time it was meant to allow addressing problems with @N
instead of full name. However, it is problematic - what the numbering
should be if e.g. --since DATE was used? Should we scan all directories
regardless because we want to show the same @N's as in full list?
Same problem with "--full List even reported problems" versus
!--full.
I think git had a right idea: "shortcut" ID should be based on
substring match, not a numbering.
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/cli/list.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/cli/list.c b/src/cli/list.c
index 840d621..4ca334f 100644
--- a/src/cli/list.c
+++ b/src/cli/list.c
@@ -82,7 +82,6 @@ static void print_crash_list(vector_of_problem_data_t *crash_list, int detailed,
continue;
}
- printf("@%i\n", i);
print_crash(crash, detailed, text_size);
if (i != crash_list->len - 1)
printf("\n");
--
1.8.1.4
10 years, 7 months
[ABRT PATCH] abrt-cli info: add "-s SIZE" option
by Denys Vlasenko
This allows users to see full data instead of this:
"proc_modules: Text file, 4137 bytes"
if they want to.
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/cli/list.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/cli/list.c b/src/cli/list.c
index c29eba5..840d621 100644
--- a/src/cli/list.c
+++ b/src/cli/list.c
@@ -31,7 +31,7 @@
*/
/** Prints basic information about a crash to stdout. */
-static void print_crash(problem_data_t *problem_data, int detailed)
+static void print_crash(problem_data_t *problem_data, int detailed, int text_size)
{
if (!problem_data)
return;
@@ -42,17 +42,17 @@ static void print_crash(problem_data_t *problem_data, int detailed)
int show_multiline = (detailed ? MAKEDESC_SHOW_MULTILINE : 0);
desc = make_description(problem_data,
/*names_to_skip:*/ NULL,
- /*max_text_size:*/ CD_TEXT_ATT_SIZE_BZ,
+ /*max_text_size:*/ text_size,
MAKEDESC_SHOW_FILES | show_multiline);
}
else
{
desc = make_description(problem_data,
/*names_to_skip:*/ NULL,
- /*max_text_size:*/ CD_TEXT_ATT_SIZE_BZ,
+ /*max_text_size:*/ text_size,
MAKEDESC_SHOW_ONLY_LIST);
}
- fprintf(stdout, "%s", desc);
+ fputs(desc, stdout);
free(desc);
}
@@ -61,7 +61,7 @@ static void print_crash(problem_data_t *problem_data, int detailed)
* @param include_reported
* Do not skip entries marked as already reported.
*/
-static void print_crash_list(vector_of_problem_data_t *crash_list, int detailed, int include_reported, long since, long until)
+static void print_crash_list(vector_of_problem_data_t *crash_list, int detailed, int include_reported, long since, long until, int text_size)
{
unsigned i;
for (i = 0; i < crash_list->len; ++i)
@@ -83,7 +83,7 @@ static void print_crash_list(vector_of_problem_data_t *crash_list, int detailed,
}
printf("@%i\n", i);
- print_crash(crash, detailed);
+ print_crash(crash, detailed, text_size);
if (i != crash_list->len - 1)
printf("\n");
}
@@ -101,7 +101,6 @@ int cmd_list(int argc, const char **argv)
int opt_until = 0;
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
- OPT_GROUP(""),
OPT_BOOL('f', "full" , &opt_full, _("List even reported problems")),
/* deprecate -d option with --pretty=full*/
OPT_BOOL('d', "detailed" , &opt_detailed, _("Show detailed report")),
@@ -123,7 +122,7 @@ int cmd_list(int argc, const char **argv)
g_ptr_array_sort_with_data(ci, &cmp_problem_data, (char *) FILENAME_LAST_OCCURRENCE);
- print_crash_list(ci, opt_detailed, opt_full, opt_since, opt_until);
+ print_crash_list(ci, opt_detailed, opt_full, opt_since, opt_until, CD_TEXT_ATT_SIZE_BZ);
free_vector_of_problem_data(ci);
list_free_with_free(D_list);
@@ -137,11 +136,12 @@ int cmd_info(int argc, const char **argv)
);
int opt_detailed = 0;
+ int text_size = CD_TEXT_ATT_SIZE_BZ;
struct options program_options[] = {
OPT__VERBOSE(&g_verbose),
- OPT_GROUP(""),
/* deprecate -d option with --pretty=full*/
- OPT_BOOL('d', "detailed" , &opt_detailed, _("Show detailed report")),
+ OPT_BOOL( 'd', "detailed" , &opt_detailed, _("Show detailed report")),
+ OPT_INTEGER('s', "size", &text_size, _("Text larger than this will be shown abridged")),
OPT_END()
};
@@ -151,6 +151,9 @@ int cmd_info(int argc, const char **argv)
if (!argv[0])
show_usage_and_die(program_usage_string, program_options);
+ if (text_size <= 0)
+ text_size = INT_MAX;
+
int errs = 0;
while (*argv)
{
@@ -163,7 +166,7 @@ int cmd_info(int argc, const char **argv)
continue;
}
- print_crash(problem, opt_detailed);
+ print_crash(problem, opt_detailed, text_size);
problem_data_free(problem);
if (*argv)
printf("\n");
--
1.8.1.4
10 years, 7 months
[LIBREPORT PATCH 1/2] fixed exception handling - closes #173
by Petr Kubat
Signed-off-by: Petr Kubat <pkubat(a)redhat.com>
---
src/client-python/debuginfo.py | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/client-python/debuginfo.py b/src/client-python/debuginfo.py
index 07e54c2..d1d78a6 100644
--- a/src/client-python/debuginfo.py
+++ b/src/client-python/debuginfo.py
@@ -1,6 +1,7 @@
from subprocess import Popen, PIPE
from yum import _, YumBase
from yum.callbacks import DownloadBaseCallback
+from yum.Errors import YumBaseError
from reportclient import *
from reportclient import _
import sys
@@ -183,9 +184,9 @@ class DebugInfoDownload(YumBase):
# cannot open Packages index using db3 - Permission denied (13)
# yum.Errors.YumBaseError: Error: rpmdb open failed
self.doConfigSetup()
- except Exception, e:
+ except YumBaseError, ex:
unmute_stdout()
- print _("Error initializing yum (YumBase.doConfigSetup): '{0!s}'").format(e)
+ print _("Error initializing yum (YumBase.doConfigSetup): '{0!s}'").format(ex)
#return 1 - can't do this in constructor
exit(1)
unmute_stdout()
@@ -232,7 +233,7 @@ class DebugInfoDownload(YumBase):
try:
repo.close()
self.repos.disableRepo(repo.id)
- except Exception, ex:
+ except YumBaseError, ex:
print _("Can't disable repository '{0!s}': {1!s}").format(repo.id, str(ex))
# This takes some time, let user know what we are doing
@@ -251,10 +252,10 @@ class DebugInfoDownload(YumBase):
# which causes artifacts on output
try:
setattr(r, "_async", False)
- except Exception, ex:
+ except (NameError, AttributeError), ex:
print ex
print _("Can't disable async download, the output might contain artifacts!")
- except Exception, ex:
+ except YumBaseError, ex:
print _("Can't setup {0}: {1}, disabling").format(r.id, ex)
self.repos.disableRepo(r.id)
@@ -265,8 +266,8 @@ class DebugInfoDownload(YumBase):
print _("Looking for needed packages in repositories")
try:
self.repos.populateSack(mdtype='metadata', cacheonly=1)
- except Exception, e:
- print _("Error retrieving metadata: '{0!s}'").format(e)
+ except YumBaseError, ex:
+ print _("Error retrieving metadata: '{0!s}'").format(ex)
#we don't want to die here, some metadata might be already retrieved
# so there is a chance we already have what we need
#return 1
@@ -278,7 +279,7 @@ class DebugInfoDownload(YumBase):
# repodata/7e6632b82c91a2e88a66ad848e231f14c48259cbf3a1c3e992a77b1fc0e9d2f6-filelists.sqlite.bz2
# from fedora-debuginfo: [Errno 256] No more mirrors to try.
self.repos.populateSack(mdtype='filelists', cacheonly=1)
- except Exception, ex:
+ except YumBaseError, ex:
print _("Error retrieving filelists: '{0!s}'").format(ex)
# we don't want to die here, some repos might be already processed
# so there is a chance we already have what we need
@@ -384,7 +385,7 @@ class DebugInfoDownload(YumBase):
# which prevents cleanup later. Fix it:
try:
os.unlink(self.tmpdir + "/" + package_file_name)
- except:
+ except OSError:
pass
print (_("Downloading package {0} failed").format(pkg))
else:
--
1.7.11.7
10 years, 7 months
[LIBREPORT PATCH] fixed the symlinks handling in get_file_list abrt/abrt#686
by Jiri Moskovcak
Signed-off-by: Jiri Moskovcak <jmoskovc(a)redhat.com>
---
src/include/file_obj.h | 4 ++++
src/lib/file_list.c | 50 ++++++++++++++++++++++++++++++++++----------------
src/lib/file_obj.c | 10 ++++++++++
3 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/src/include/file_obj.h b/src/include/file_obj.h
index 08823af..4f46bf6 100644
--- a/src/include/file_obj.h
+++ b/src/include/file_obj.h
@@ -30,3 +30,7 @@ typedef struct file_obj
char *filename;
char *fullpath; //the full path with extension
} file_obj_t;
+
+void free_file_obj(file_obj_t *f);
+const char *fo_get_fullpath(file_obj_t *fo);
+const char *fo_get_filename(file_obj_t *fo);
diff --git a/src/lib/file_list.c b/src/lib/file_list.c
index 49cc4e1..3d0e43d 100644
--- a/src/lib/file_list.c
+++ b/src/lib/file_list.c
@@ -31,14 +31,21 @@ GList *get_file_list(const char *path, const char *ext_filter)
struct dirent *dent;
while ((dent = readdir(dir)) != NULL)
{
- char *ext = strrchr(dent->d_name, '.');
- if (!ext)
+ /* skip . and .. */
+ if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0)
continue;
- if (ext_filter && strcmp(ext + 1, ext_filter) != 0)
- continue;
-
char *fullname = concat_path_file(path, dent->d_name);
- *ext = '\0';
+ char *ext = NULL;
+
+ if (ext_filter)
+ {
+ ext = strrchr(dent->d_name, '.');
+ if (!ext)
+ continue;
+ if (ext_filter && strcmp(ext + 1, ext_filter) != 0)
+ continue;
+ *ext = '\0';
+ }
//TODO: get rid of special handling of symlinks?
struct stat buf;
@@ -50,20 +57,31 @@ GList *get_file_list(const char *path, const char *ext_filter)
GError *error = NULL;
gchar *link = g_file_read_link(fullname, &error);
if (error != NULL)
- error_msg_and_die("Error reading symlink '%s': %s", fullname, error->message);
+ {
+ error_msg("Error reading symlink '%s': %s", fullname, error->message);
+ goto next;
+ }
gchar *target = g_path_get_basename(link);
- char *ext = strrchr(target, '.');
+ VERB3 log("Symlink '%s' is pointing to '%s'", link, target);
+ if (ext_filter)
+ {
+ char *ext = strrchr(target, '.');
-//FIXME: why "xml"? Shouldn't it be ext_filter?
- if (!ext || 0 != strcmp(ext + 1, "xml"))
- error_msg_and_die("Invalid event symlink '%s': expected it to"
- " point to another xml file", fullname);
- *ext = '\0';
- //@@TODO symlink handling is broken!!
- //g_hash_table_replace(g_event_config_symlinks, xstrdup(dent->d_name), target);
+ //FIXME: why "xml"? Shouldn't it be ext_filter?
+ if (!ext || 0 != strcmp(ext + 1, ext_filter))
+ {
+ error_msg("Invalid event symlink '%s': expected it to"
+ " point to another '%s' file", fullname, ext_filter);
+ goto next;
+ }
+ *ext = '\0';
+ }
+ free(fullname);
+ fullname = concat_path_file(path, target);
+ files = g_list_prepend(files, new_file_obj(fullname, target));
g_free(link);
- /* don't free target, it is owned by the hash table now */
+ g_free(target);
goto next;
}
diff --git a/src/lib/file_obj.c b/src/lib/file_obj.c
index 4aaffb8..bbb5b9f 100644
--- a/src/lib/file_obj.c
+++ b/src/lib/file_obj.c
@@ -36,3 +36,13 @@ void free_file_obj(file_obj_t *f)
free(f->filename);
free(f);
}
+
+const char *fo_get_fullpath(file_obj_t *fo)
+{
+ return fo->fullpath;
+}
+
+const char *fo_get_filename(file_obj_t *fo)
+{
+ return fo->filename;
+}
\ No newline at end of file
--
1.8.3.1
10 years, 7 months
[BTPARSER PATCH] add dump_stack to kernel modules blacklist
by Richard Marko
From: Richard Marko <rmarko(a)redhat.com>
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
lib/normalize_oops.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/normalize_oops.c b/lib/normalize_oops.c
index 5b2df56..36fd4d8 100644
--- a/lib/normalize_oops.c
+++ b/lib/normalize_oops.c
@@ -36,6 +36,7 @@ btp_normalize_oops_thread(struct btp_thread *thread)
const char *blacklist[] = {
"do_softirq",
"do_vfs_ioctl",
+ "dump_stack",
"flush_kthread_worker",
"gs_change",
"irq_exit",
--
1.8.3.1
10 years, 8 months
[SATYR PATCH] python: API documentation
by Martin Milata
Currently only manpage is generated, I'm not sure where html documentation
should go. Can it be shipped directly in the satyr-python subpackage?
Martin Milata (1):
python: API documentation
configure.ac | 1 +
python/Makefile.am | 2 +
python/doc/Makefile.am | 138 ++++++++++++++++++++++++
python/doc/clustering.rst | 17 +++
python/doc/conf.py.in | 243 ++++++++++++++++++++++++++++++++++++++++++
python/doc/index.rst | 25 +++++
python/doc/report.rst | 26 +++++
python/doc/satyr.py | 12 +++
python/doc/stacktrace.rst | 144 +++++++++++++++++++++++++
python/py_base_frame.c | 2 +-
python/py_base_stacktrace.c | 12 +--
python/py_base_thread.c | 18 ++--
python/py_cluster.c | 11 +-
python/py_core_frame.c | 13 ++-
python/py_core_stacktrace.c | 12 +--
python/py_core_thread.c | 11 +-
python/py_gdb_frame.c | 26 ++---
python/py_gdb_sharedlib.c | 6 +-
python/py_gdb_stacktrace.c | 50 ++++-----
python/py_gdb_thread.c | 26 ++---
python/py_java_frame.c | 12 +--
python/py_java_stacktrace.c | 12 +--
python/py_java_thread.c | 24 ++---
python/py_koops_frame.c | 12 +--
python/py_koops_stacktrace.c | 19 ++--
python/py_metrics.c | 32 +++---
python/py_operating_system.c | 6 +-
python/py_python_frame.c | 12 +--
python/py_python_stacktrace.c | 24 ++---
python/py_report.c | 17 +--
python/py_rpm_package.c | 6 +-
satyr.spec.in | 2 +
32 files changed, 786 insertions(+), 187 deletions(-)
create mode 100644 python/doc/Makefile.am
create mode 100644 python/doc/clustering.rst
create mode 100644 python/doc/conf.py.in
create mode 100644 python/doc/index.rst
create mode 100644 python/doc/report.rst
create mode 100644 python/doc/satyr.py
create mode 100644 python/doc/stacktrace.rst
--
1.8.3.1
10 years, 8 months
[SATYR PATCH] add dump_stack to kernel modules blacklist
by Richard Marko
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
lib/koops_stacktrace.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/koops_stacktrace.c b/lib/koops_stacktrace.c
index a4e19f2..0e7bbd1 100644
--- a/lib/koops_stacktrace.c
+++ b/lib/koops_stacktrace.c
@@ -707,6 +707,7 @@ sr_normalize_koops_stacktrace(struct sr_koops_stacktrace *stacktrace)
const char *blacklist[] = {
"do_softirq",
"do_vfs_ioctl",
+ "dump_stack",
"flush_kthread_worker",
"gs_change",
"irq_exit",
--
1.8.3.1
10 years, 8 months