libreport/0001-rhbz795548-opt-out-smolt.patch

135 lines
5.2 KiB
Diff
Raw Normal View History

commit f01bb3bc293f91eacb9196229746ab95580f8b58
Author: Nikola Pajkovsky <npajkovs@redhat.com>
Date: Tue Apr 3 16:31:10 2012 +0200
rhbz#795548 - opt kernel out of showing smolt information in abrt bug reports
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index d99d84c..892a70f 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -572,6 +572,7 @@ enum {
MAKEDESC_SHOW_FILES = (1 << 0),
MAKEDESC_SHOW_MULTILINE = (1 << 1),
MAKEDESC_SHOW_ONLY_LIST = (1 << 2),
+ MAKEDESC_WHITELIST = (1 << 3),
};
#define make_description libreport_make_description
char *make_description(problem_data_t *problem_data, char **names_to_skip, unsigned max_text_size, unsigned desc_flags);
@@ -579,6 +580,8 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip, unsig
char* make_description_bz(problem_data_t *problem_data, unsigned max_text_size);
#define make_description_logger libreport_make_description_logger
char* make_description_logger(problem_data_t *problem_data, unsigned max_text_size);
+#define make_description_koops libreport_make_description_koops
+char* make_description_koops(problem_data_t *problem_data, unsigned max_text_size);
//UNUSED
//#define make_description_mailx libreport_make_description_mailx
//char* make_description_mailx(problem_data_t *problem_data);
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index a1a9234..68133a2 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -18,7 +18,16 @@
*/
#include "internal_libreport.h"
-char *make_description(problem_data_t *problem_data, char **names_to_skip, unsigned max_text_size, unsigned desc_flags)
+static bool rejected_name(const char *name, char **v, int flags)
+{
+ bool r = is_in_string_list(name, v);
+ if (flags & MAKEDESC_WHITELIST)
+ r = !r;
+ return r;
+}
+
+char *make_description(problem_data_t *problem_data, char **names_to_skip,
+ unsigned max_text_size, unsigned desc_flags)
{
struct strbuf *buf_dsc = strbuf_new();
@@ -42,7 +51,8 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip, unsig
/* Skip items we are not interested in */
//TODO: optimize by doing this once, not 3 times:
- if (names_to_skip && is_in_string_list(key, names_to_skip))
+ if (names_to_skip
+ && rejected_name(key, names_to_skip, desc_flags))
continue;
struct problem_item *item = g_hash_table_lookup(problem_data, key);
@@ -87,7 +97,8 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip, unsig
l = l->next;
/* Skip items we are not interested in */
- if (names_to_skip && is_in_string_list(key, names_to_skip))
+ if (names_to_skip
+ && rejected_name(key, names_to_skip, desc_flags))
continue;
struct problem_item *item = g_hash_table_lookup(problem_data, key);
@@ -144,7 +155,8 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip, unsig
l = l->next;
/* Skip items we are not interested in */
- if (names_to_skip && is_in_string_list(key, names_to_skip))
+ if (names_to_skip
+ && rejected_name(key, names_to_skip, desc_flags))
continue;
struct problem_item *item = g_hash_table_lookup(problem_data, key);
@@ -251,11 +263,6 @@ static const char *const blacklisted_items[] = {
NULL
};
-/*
- * npajkovs: implement second part of problem (not so important)
- * https://bugzilla.redhat.com/show_bug.cgi?id=711591
- */
-
char* make_description_bz(problem_data_t *problem_data, unsigned max_text_size)
{
return make_description(
@@ -275,3 +282,22 @@ char* make_description_logger(problem_data_t *problem_data, unsigned max_text_si
MAKEDESC_SHOW_FILES | MAKEDESC_SHOW_MULTILINE
);
}
+
+/* Items we want to include to bz */
+static const char *const whitelisted_items[] = {
+ FILENAME_CMDLINE,
+ FILENAME_BACKTRACE,
+ NULL
+};
+
+char* make_description_koops(problem_data_t *problem_data, unsigned max_text_size)
+{
+ return make_description(
+ problem_data,
+ (char**)whitelisted_items,
+ max_text_size,
+ MAKEDESC_SHOW_FILES
+ | MAKEDESC_SHOW_MULTILINE
+ | MAKEDESC_WHITELIST
+ );
+}
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 9ed3154..a3aa2ef 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -438,7 +438,12 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
}
char *status_whiteboard = xasprintf("abrt_hash:%s", duphash);
- char *bz_dsc = make_description_bz(problem_data, CD_TEXT_ATT_SIZE_BZ);
+ char *bz_dsc;
+ if (analyzer && !strcmp(analyzer, "Kerneloops"))
+ bz_dsc = make_description_koops(problem_data, CD_TEXT_ATT_SIZE_BZ);
+ else
+ bz_dsc = make_description_bz(problem_data, CD_TEXT_ATT_SIZE_BZ);
+
char *full_dsc = xasprintf("libreport version: "VERSION"\n%s", bz_dsc);
free(bz_dsc);