diff --git a/0001-allow-to-specify-bodh-url-and-fix-one-NULL-dereferen.patch b/0001-allow-to-specify-bodh-url-and-fix-one-NULL-dereferen.patch deleted file mode 100644 index f0b7bd3..0000000 --- a/0001-allow-to-specify-bodh-url-and-fix-one-NULL-dereferen.patch +++ /dev/null @@ -1,90 +0,0 @@ -From b26c6d5a3b9aff0933fb9abd393fd3c5f3b6cd02 Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Mon, 5 Dec 2011 18:48:17 +0100 -Subject: [PATCH 1/6] allow to specify bodh url and fix one NULL dereferencing - -Signed-off-by: Nikola Pajkovsky ---- - src/include/internal_libreport.h | 2 +- - src/plugins/abrt-bodhi.c | 20 ++++++++++++++++---- - 2 files changed, 17 insertions(+), 5 deletions(-) - -diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h -index 4c50a26..c153aaa 100644 ---- a/src/include/internal_libreport.h -+++ b/src/include/internal_libreport.h -@@ -715,7 +715,7 @@ struct options { - #define OPT_LIST( s, l, v, a, h) { OPTION_LIST , (s), (l), (v), (a) , (h) } - - #define OPT__VERBOSE(v) OPT_BOOL('v', "verbose", (v), _("Be verbose")) --#define OPT__DUMP_DIR(v) OPT_STRING('d', "dump-dir", (v), "DIR", _("Dump directory")) -+#define OPT__DUMP_DIR(v) OPT_STRING('d', "problem-dir", (v), "DIR", _("Problem directory")) - - #define parse_opts libreport_parse_opts - unsigned parse_opts(int argc, char **argv, const struct options *opt, -diff --git a/src/plugins/abrt-bodhi.c b/src/plugins/abrt-bodhi.c -index 28aa439..3495c24 100644 ---- a/src/plugins/abrt-bodhi.c -+++ b/src/plugins/abrt-bodhi.c -@@ -110,7 +110,7 @@ - } - */ - --static const char *const bodhi_url = "https://admin.fedoraproject.org/updates/%s"; -+static const char *bodhi_url = "https://admin.fedoraproject.org/updates/"; - - struct bodhi { - char *nvr; -@@ -288,10 +288,10 @@ static GHashTable *bodhi_parse_json(json_object *json, const char *release) - - static GHashTable *bodhi_query_list(const char *query, const char *release) - { -- char *bodhi_url_bugs = xasprintf(bodhi_url, "list"); -+ char *bodhi_url_bugs = xasprintf("%s/list", bodhi_url); - - abrt_post_state_t *post_state = new_abrt_post_state( -- ABRT_POST_WANT_BODY|ABRT_POST_WANT_SSL_VERIFY); -+ ABRT_POST_WANT_BODY | ABRT_POST_WANT_SSL_VERIFY | ABRT_POST_WANT_ERROR_MSG); - - const char *headers[] = { - "Accept: application/json", -@@ -301,6 +301,13 @@ static GHashTable *bodhi_query_list(const char *query, const char *release) - log(_("Searching for updates")); - abrt_post_string(post_state, bodhi_url_bugs, "application/x-www-form-urlencoded", - headers, query); -+ -+ if (post_state->http_resp_code != 200) -+ { -+ char *errmsg = post_state->curl_error_msg; -+ if (errmsg && errmsg[0]) -+ error_msg_and_die("%s '%s'", errmsg, bodhi_url_bugs); -+ } - free(bodhi_url_bugs); - - // log("%s", post_state->body); -@@ -357,9 +364,11 @@ int main(int argc, char **argv) - /* Keep enum above and order of options below in sync! */ - struct options program_options[] = { - OPT__VERBOSE(&g_verbose), -+ OPT__DUMP_DIR(&dump_dir_path), -+ OPT_GROUP(""), - OPT_STRING('b', "bugs", &bugs, "ID1[,ID2,...]" , _("List of bug ids")), -+ OPT_STRING('u', "url", &bodhi_url, "URL", _("Specify a bodhi server url")), - OPT_OPTSTRING('r', "release", &release, "RELEASE", _("Specify a release")), -- OPT__DUMP_DIR(&dump_dir_path), - OPT_END() - }; - -@@ -387,6 +396,9 @@ int main(int argc, char **argv) - else - { - struct dump_dir *dd = dd_opendir(dump_dir_path, DD_OPEN_READONLY); -+ if (!dd) -+ xfunc_die(); -+ - problem_data_t *problem_data = create_problem_data_from_dump_dir(dd); - dd_close(dd); - if (!problem_data) --- -1.7.7.3 - diff --git a/0001-fixed-memory-leak-in-comment-dup.patch b/0001-fixed-memory-leak-in-comment-dup.patch new file mode 100644 index 0000000..6e1dcfe --- /dev/null +++ b/0001-fixed-memory-leak-in-comment-dup.patch @@ -0,0 +1,43 @@ +commit f737cd88eef6c8cde03b3a317cd5ef390f0138e4 +Author: Jakub Filak +Date: Wed Apr 18 15:09:02 2012 +0200 + + trac#480 : fixed memory leak in is_comment_dup() function + + Signed-off-by: Jakub Filak + +diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c +index a3aa2ef..2e7d62c 100644 +--- a/src/plugins/rhbz.c ++++ b/src/plugins/rhbz.c +@@ -88,20 +88,19 @@ static char *trim_all_whitespace(const char *str) + + int is_comment_dup(GList *comments, const char *comment) + { +- for (GList *l = comments; l; l = l->next) ++ char * const trim_comment = trim_all_whitespace(comment); ++ bool same_comments = false; ++ ++ for (GList *l = comments; l && !same_comments; l = l->next) + { +- char *comment_body = (char *) l->data; +- char *trim_comment_body = trim_all_whitespace(comment_body); +- char *trim_comment = trim_all_whitespace(comment); +- if (!strcmp(trim_comment_body, trim_comment)) +- { +- free(trim_comment_body); +- free(trim_comment); +- return 1; +- } ++ const char * const comment_body = (const char *) l->data; ++ char * const trim_comment_body = trim_all_whitespace(comment_body); ++ same_comments = !strcmp(trim_comment_body, trim_comment); ++ free(trim_comment_body); + } + +- return 0;; ++ free(trim_comment); ++ return same_comments; + } + + static unsigned find_best_bt_rating_in_comments(GList *comments) diff --git a/0001-rhbz-768647-python-doen-t-have-a-backtrace_rating-fi.patch b/0001-rhbz-768647-python-doen-t-have-a-backtrace_rating-fi.patch deleted file mode 100644 index 46384ba..0000000 --- a/0001-rhbz-768647-python-doen-t-have-a-backtrace_rating-fi.patch +++ /dev/null @@ -1,56 +0,0 @@ -From e93f6cb75fe3ad7991deff0696538c93ee04cc7a Mon Sep 17 00:00:00 2001 -Message-Id: -From: Nikola Pajkovsky -Date: Mon, 19 Dec 2011 19:09:28 +0100 -Subject: [PATCH] rhbz#768647 - python doen't have a backtrace_rating file - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/reporter-bugzilla.c | 10 ++++++++-- - src/plugins/rhbz.c | 2 +- - 2 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c -index d27e804..4dd9ec2 100644 ---- a/src/plugins/reporter-bugzilla.c -+++ b/src/plugins/reporter-bugzilla.c -@@ -392,7 +392,10 @@ int main(int argc, char **argv) - - struct strbuf *full_desc = strbuf_new(); - strbuf_append_strf(full_desc, "%s\n\n", comment); -- strbuf_append_strf(full_desc, "rating: %s\n", rating_str); -+ -+ /* python doesn't have rating file */ -+ if (rating_str) -+ strbuf_append_strf(full_desc, "%s: %s\n", FILENAME_RATING, rating_str); - strbuf_append_strf(full_desc, "Package: %s\n", package); - /* attach the architecture only if it's different from the initial report */ - if ((strcmp(bz->bi_platform, "All") != 0) && -@@ -423,7 +426,10 @@ int main(int argc, char **argv) - } - strbuf_free(full_desc); - -- unsigned rating = xatou(rating_str); -+ unsigned rating = 0; -+ /* python doesn't have rating file */ -+ if (rating_str) -+ rating = xatou(rating_str); - if (!allow_comment && (bz->bi_best_bt_rating < rating)) - { - char bug_id_str[sizeof(int)*3 + 2]; -diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c -index 704b5dc..592fbae 100644 ---- a/src/plugins/rhbz.c -+++ b/src/plugins/rhbz.c -@@ -115,7 +115,7 @@ static unsigned find_best_bt_rating_in_comments(GList *comments) - { - char *comment_body = (char *) l->data; - -- char *start_rating_line = strstr(comment_body, "rating: "); -+ char *start_rating_line = strstr(comment_body, FILENAME_RATING": "); - if (!start_rating_line) - { - VERB3 error_msg("comment does not contain rating"); --- -1.7.8 - diff --git a/0001-rhbz-820985-bz-4.2-doesn-t-have-bug_id-member-it-s-i.patch b/0001-rhbz-820985-bz-4.2-doesn-t-have-bug_id-member-it-s-i.patch new file mode 100644 index 0000000..461287f --- /dev/null +++ b/0001-rhbz-820985-bz-4.2-doesn-t-have-bug_id-member-it-s-i.patch @@ -0,0 +1,237 @@ +From 386bcecdff5eeea2f0855e9b91b73f862fa11860 Mon Sep 17 00:00:00 2001 +From: Nikola Pajkovsky +Date: Mon, 14 May 2012 13:03:25 +0200 +Subject: [PATCH 1/3] rhbz#820985 - bz 4.2 doesn't have 'bug_id' member; it's + 'id' + +Signed-off-by: Nikola Pajkovsky +--- + src/plugins/rhbz.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 55 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c +index 2e7d62c..24bec16 100644 +--- a/src/plugins/rhbz.c ++++ b/src/plugins/rhbz.c +@@ -22,8 +22,20 @@ + + #define MAX_HOPS 5 + ++ ++//#define DEBUG ++#ifdef DEBUG ++#define func_entry() log("-- %s", __func__) ++#define func_entry_str(x) log("-- %s\t%s", __func__, (x)) ++#else ++#define func_entry() ++#define func_entry_str(x) ++#endif ++ + struct bug_info *new_bug_info() + { ++ func_entry(); ++ + struct bug_info *bi = xzalloc(sizeof(struct bug_info)); + bi->bi_dup_id = -1; + +@@ -32,6 +44,8 @@ struct bug_info *new_bug_info() + + void free_bug_info(struct bug_info *bi) + { ++ func_entry(); ++ + if (!bi) + return; + +@@ -47,6 +61,8 @@ void free_bug_info(struct bug_info *bi) + + static GList *parse_comments(xmlrpc_value *result_xml) + { ++ func_entry(); ++ + GList *comments = NULL; + xmlrpc_value *comments_memb = rhbz_get_member("longdescs", result_xml); + if (!comments_memb) +@@ -74,6 +90,8 @@ static GList *parse_comments(xmlrpc_value *result_xml) + + static char *trim_all_whitespace(const char *str) + { ++ func_entry(); ++ + char *trim = xzalloc(sizeof(char) * strlen(str) + 1); + int i = 0; + while (*str) +@@ -88,6 +106,8 @@ static char *trim_all_whitespace(const char *str) + + int is_comment_dup(GList *comments, const char *comment) + { ++ func_entry(); ++ + char * const trim_comment = trim_all_whitespace(comment); + bool same_comments = false; + +@@ -105,6 +125,8 @@ int is_comment_dup(GList *comments, const char *comment) + + static unsigned find_best_bt_rating_in_comments(GList *comments) + { ++ func_entry(); ++ + if (!comments) + return 0; + +@@ -148,6 +170,8 @@ static unsigned find_best_bt_rating_in_comments(GList *comments) + + void rhbz_login(struct abrt_xmlrpc *ax, struct bugzilla_struct *b) + { ++ func_entry(); ++ + xmlrpc_value* result = abrt_xmlrpc_call(ax, "User.login", "({s:s,s:s})", + "login", b->b_login, "password", b->b_password); + +@@ -162,6 +186,8 @@ void rhbz_login(struct abrt_xmlrpc *ax, struct bugzilla_struct *b) + xmlrpc_value *rhbz_search_duphash(struct abrt_xmlrpc *ax, const char *component, + const char *product, const char *duphash) + { ++ func_entry(); ++ + struct strbuf *query = strbuf_new(); + strbuf_append_strf(query, "ALL whiteboard:\"%s\"", duphash); + +@@ -181,6 +207,8 @@ xmlrpc_value *rhbz_search_duphash(struct abrt_xmlrpc *ax, const char *component, + + xmlrpc_value *rhbz_get_member(const char *member, xmlrpc_value *xml) + { ++ func_entry_str(member); ++ + xmlrpc_env env; + xmlrpc_env_init(&env); + +@@ -203,6 +231,8 @@ xmlrpc_value *rhbz_get_member(const char *member, xmlrpc_value *xml) + */ + int rhbz_array_size(xmlrpc_value *xml) + { ++ func_entry(); ++ + xmlrpc_env env; + xmlrpc_env_init(&env); + +@@ -216,6 +246,8 @@ int rhbz_array_size(xmlrpc_value *xml) + /* die or return bug id; each bug must have bug id otherwise xml is corrupted */ + int rhbz_bug_id(xmlrpc_value* xml) + { ++ func_entry(); ++ + xmlrpc_env env; + xmlrpc_env_init(&env); + +@@ -227,7 +259,7 @@ int rhbz_bug_id(xmlrpc_value* xml) + if (env.fault_occurred) + abrt_xmlrpc_die(&env); + +- bug = rhbz_get_member("bug_id", item); ++ bug = rhbz_get_member("id", item); + xmlrpc_DECREF(item); + if (!bug) + abrt_xmlrpc_die(&env); +@@ -247,6 +279,8 @@ int rhbz_bug_id(xmlrpc_value* xml) + // TODO: npajkovs: add flag to read xmlrpc_read_array_item first + void *rhbz_bug_read_item(const char *memb, xmlrpc_value *xml, int flags) + { ++ func_entry(); ++ + xmlrpc_env env; + xmlrpc_env_init(&env); + +@@ -293,6 +327,8 @@ die: + + GList *rhbz_bug_cc(xmlrpc_value* result_xml) + { ++ func_entry(); ++ + xmlrpc_env env; + xmlrpc_env_init(&env); + +@@ -335,6 +371,8 @@ GList *rhbz_bug_cc(xmlrpc_value* result_xml) + + struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id) + { ++ func_entry(); ++ + struct bug_info *bz = new_bug_info(); + xmlrpc_value *xml_bug_response = abrt_xmlrpc_call(ax, "bugzilla.getBug", + "(i)", bug_id); +@@ -384,6 +422,8 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id) + int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data, + const char *release) + { ++ func_entry(); ++ + const char *package = get_problem_item_content_or_NULL(problem_data, + FILENAME_PACKAGE); + const char *component = get_problem_item_content_or_NULL(problem_data, +@@ -483,6 +523,8 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data, + int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *filename, + const char *bug_id, const char *data, int data_len, int flags) + { ++ func_entry(); ++ + char *encoded64 = encode_base64(data, data_len); + char *fn = xasprintf("File: %s", filename); + xmlrpc_value* result; +@@ -509,6 +551,8 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *filename, + int rhbz_attach_fd(struct abrt_xmlrpc *ax, const char *filename, + const char *bug_id, int fd, int flags) + { ++ func_entry(); ++ + off_t size = lseek(fd, 0, SEEK_END); + if (size < 0) + { +@@ -547,6 +591,8 @@ int rhbz_attach_fd(struct abrt_xmlrpc *ax, const char *filename, + int rhbz_attach_big_files(struct abrt_xmlrpc *ax, const char *bug_id, + problem_data_t *problem_data, int flags) + { ++ func_entry(); ++ + GHashTableIter iter; + char *name; + struct problem_item *value; +@@ -600,6 +646,8 @@ int rhbz_attach_big_files(struct abrt_xmlrpc *ax, const char *bug_id, + + void rhbz_logout(struct abrt_xmlrpc *ax) + { ++ func_entry(); ++ + xmlrpc_value* result = abrt_xmlrpc_call(ax, "User.logout", "(s)", ""); + if (result) + xmlrpc_DECREF(result); +@@ -608,6 +656,8 @@ void rhbz_logout(struct abrt_xmlrpc *ax) + struct bug_info *rhbz_find_origin_bug_closed_duplicate(struct abrt_xmlrpc *ax, + struct bug_info *bi) + { ++ func_entry(); ++ + struct bug_info *bi_tmp = new_bug_info(); + bi_tmp->bi_id = bi->bi_id; + bi_tmp->bi_dup_id = bi->bi_dup_id; +@@ -634,6 +684,8 @@ struct bug_info *rhbz_find_origin_bug_closed_duplicate(struct abrt_xmlrpc *ax, + /* suppress mail notify by {s:i} (nomail:1) */ + void rhbz_mail_to_cc(struct abrt_xmlrpc *ax, int bug_id, const char *mail, int flags) + { ++ func_entry(); ++ + xmlrpc_value *result; + int nomail_notify = IS_NOMAIL_NOTIFY(flags); + result = abrt_xmlrpc_call(ax, "Bug.update", "({s:i,s:{s:(s),s:i}})", +@@ -647,6 +699,8 @@ void rhbz_mail_to_cc(struct abrt_xmlrpc *ax, int bug_id, const char *mail, int f + void rhbz_add_comment(struct abrt_xmlrpc *ax, int bug_id, const char *comment, + int flags) + { ++ func_entry(); ++ + int private = IS_PRIVATE(flags); + int nomail_notify = IS_NOMAIL_NOTIFY(flags); + +-- +1.7.10.1 + diff --git a/0001-rhbz-add-the-architecture-to-the-comment-only-if-it-.patch b/0001-rhbz-add-the-architecture-to-the-comment-only-if-it-.patch deleted file mode 100644 index 31c23c2..0000000 --- a/0001-rhbz-add-the-architecture-to-the-comment-only-if-it-.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 93c1aeb02086cfe5dbf6f9201956a7ab5fc1f631 Mon Sep 17 00:00:00 2001 -Message-Id: <93c1aeb02086cfe5dbf6f9201956a7ab5fc1f631.1324378958.git.npajkovs@redhat.com> -From: Jiri Moskovcak -Date: Fri, 9 Dec 2011 14:28:54 +0100 -Subject: [PATCH] rhbz: add the architecture to the comment only if it differs - from initial comment rhbz#711591 - ---- - src/plugins/reporter-bugzilla.c | 10 +++++++++- - src/plugins/rhbz.c | 2 ++ - src/plugins/rhbz.h | 1 + - 3 files changed, 12 insertions(+), 1 deletions(-) - -diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c -index d057114..d27e804 100644 ---- a/src/plugins/reporter-bugzilla.c -+++ b/src/plugins/reporter-bugzilla.c -@@ -394,7 +394,15 @@ int main(int argc, char **argv) - strbuf_append_strf(full_desc, "%s\n\n", comment); - strbuf_append_strf(full_desc, "rating: %s\n", rating_str); - strbuf_append_strf(full_desc, "Package: %s\n", package); -- strbuf_append_strf(full_desc, "Architecture: %s\n", arch); -+ /* attach the architecture only if it's different from the initial report */ -+ if ((strcmp(bz->bi_platform, "All") != 0) && -+ (strcmp(bz->bi_platform, "Unspecified") != 0) && -+ (strcmp(bz->bi_platform, arch) !=0)) -+ strbuf_append_strf(full_desc, "Architecture: %s\n", arch); -+ else -+ { -+ VERB3 log("not adding the arch: %s because rep_plat is %s", arch, bz->bi_platform); -+ } - strbuf_append_strf(full_desc, "OS Release: %s\n", release); - - /* unused code, enable it when gui/cli will be ready -diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c -index 4c3c91f..704b5dc 100644 ---- a/src/plugins/rhbz.c -+++ b/src/plugins/rhbz.c -@@ -352,6 +352,8 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id) - RHBZ_MANDATORY_MEMB | RHBZ_READ_STR); - bz->bi_resolution = rhbz_bug_read_item("resolution", xml_bug_response, - RHBZ_READ_STR); -+ bz->bi_platform = rhbz_bug_read_item("rep_platform", xml_bug_response, -+ RHBZ_READ_STR); - - if (strcmp(bz->bi_status, "CLOSED") == 0 && !bz->bi_resolution) - error_msg_and_die(_("Bug %i is CLOSED, but it has no RESOLUTION"), bz->bi_id); -diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h -index 141db7d..4b39dc3 100644 ---- a/src/plugins/rhbz.h -+++ b/src/plugins/rhbz.h -@@ -54,6 +54,7 @@ struct bug_info { - char *bi_resolution; - char *bi_reporter; - char *bi_product; -+ char *bi_platform; - - GList *bi_cc_list; - GList *bi_comments; --- -1.7.8 - diff --git a/0001-rhbz795548-opt-out-smolt.patch b/0001-rhbz795548-opt-out-smolt.patch new file mode 100644 index 0000000..c54beb4 --- /dev/null +++ b/0001-rhbz795548-opt-out-smolt.patch @@ -0,0 +1,134 @@ +commit f01bb3bc293f91eacb9196229746ab95580f8b58 +Author: Nikola Pajkovsky +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 + +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); + diff --git a/0002-bugzilla-query-bz-version-and-for-4.2-use-id-element.patch b/0002-bugzilla-query-bz-version-and-for-4.2-use-id-element.patch new file mode 100644 index 0000000..984cb2c --- /dev/null +++ b/0002-bugzilla-query-bz-version-and-for-4.2-use-id-element.patch @@ -0,0 +1,113 @@ +From add5f6eed5cae2f0618707ed9c642f692426d8d7 Mon Sep 17 00:00:00 2001 +From: Nikola Pajkovsky +Date: Mon, 14 May 2012 13:53:51 +0200 +Subject: [PATCH 2/3] bugzilla: query bz version and for 4.2 use 'id' element + for getting bug number, for others use 'bug_id' + +Signed-off-by: Nikola Pajkovsky +--- + src/plugins/reporter-bugzilla.c | 8 ++++++-- + src/plugins/rhbz.c | 28 ++++++++++++++++++++++++++-- + src/plugins/rhbz.h | 3 ++- + 3 files changed, 34 insertions(+), 5 deletions(-) + +diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c +index 6584f0f..3b6d168 100644 +--- a/src/plugins/reporter-bugzilla.c ++++ b/src/plugins/reporter-bugzilla.c +@@ -168,8 +168,10 @@ int main(int argc, char **argv) + int all_bugs_size = rhbz_array_size(all_bugs); + if (all_bugs_size > 0) + { +- int bug_id = rhbz_bug_id(all_bugs); ++ char *rhbz_ver = rhbz_version(client); ++ int bug_id = rhbz_bug_id(all_bugs, rhbz_ver); + printf("%i", bug_id); ++ free(rhbz_ver); + } + + exit(EXIT_SUCCESS); +@@ -357,9 +359,11 @@ int main(int argc, char **argv) + } + else + { +- int bug_id = rhbz_bug_id(all_bugs); ++ char *rhbz_ver = rhbz_version(client); ++ int bug_id = rhbz_bug_id(all_bugs, rhbz_ver); + xmlrpc_DECREF(all_bugs); + bz = rhbz_bug_info(client, bug_id); ++ free(rhbz_ver); + } + } + else +diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c +index 24bec16..df2838f 100644 +--- a/src/plugins/rhbz.c ++++ b/src/plugins/rhbz.c +@@ -243,8 +243,26 @@ int rhbz_array_size(xmlrpc_value *xml) + return size; + } + ++ ++char *rhbz_version(struct abrt_xmlrpc *ax) ++{ ++ func_entry(); ++ ++ xmlrpc_value *result; ++ result = abrt_xmlrpc_call(ax, "Bugzilla.version", "()"); ++ ++ char *version = NULL; ++ if (result) ++ { ++ version = rhbz_bug_read_item("version", result, RHBZ_READ_STR); ++ xmlrpc_DECREF(result); ++ } ++ ++ return version; ++} ++ + /* die or return bug id; each bug must have bug id otherwise xml is corrupted */ +-int rhbz_bug_id(xmlrpc_value* xml) ++int rhbz_bug_id(xmlrpc_value* xml, const char *ver) + { + func_entry(); + +@@ -259,7 +277,13 @@ int rhbz_bug_id(xmlrpc_value* xml) + if (env.fault_occurred) + abrt_xmlrpc_die(&env); + +- bug = rhbz_get_member("id", item); ++ char *id; ++ if (!prefixcmp(ver, "4.2")) ++ id = "id"; ++ else ++ id = "bug_id"; ++ ++ bug = rhbz_get_member(id, item); + xmlrpc_DECREF(item); + if (!bug) + abrt_xmlrpc_die(&env); +diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h +index c9023e9..85bcca1 100644 +--- a/src/plugins/rhbz.h ++++ b/src/plugins/rhbz.h +@@ -97,7 +97,7 @@ xmlrpc_value *rhbz_get_member(const char *member, xmlrpc_value *xml); + + int rhbz_array_size(xmlrpc_value *xml); + +-int rhbz_bug_id(xmlrpc_value *xml); ++int rhbz_bug_id(xmlrpc_value *xml, const char *ver); + + int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data, + const char *release); +@@ -120,6 +120,7 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id); + + struct bug_info *rhbz_find_origin_bug_closed_duplicate(struct abrt_xmlrpc *ax, + struct bug_info *bi); ++char *rhbz_version(struct abrt_xmlrpc *ax); + + #ifdef __cplusplus + } +-- +1.7.10.1 + diff --git a/0002-if-better-backtrace-is-avail-then-upload-one.patch b/0002-if-better-backtrace-is-avail-then-upload-one.patch deleted file mode 100644 index ad2020b..0000000 --- a/0002-if-better-backtrace-is-avail-then-upload-one.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 480d39f86254f6088e53b69520b7354fa992b594 Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Tue, 29 Nov 2011 15:25:59 +0100 -Subject: [PATCH 2/6] if better backtrace is avail, then upload one - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/reporter-bugzilla.c | 17 ++++++++++- - src/plugins/rhbz.c | 62 +++++++++++++++++++++++++++++++++++---- - src/plugins/rhbz.h | 1 + - 3 files changed, 73 insertions(+), 7 deletions(-) - -diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c -index 4046b24..4739c2e 100644 ---- a/src/plugins/reporter-bugzilla.c -+++ b/src/plugins/reporter-bugzilla.c -@@ -377,14 +377,16 @@ int main(int argc, char **argv) - { - const char *package = get_problem_item_content_or_NULL(problem_data, FILENAME_PACKAGE); - const char *arch = get_problem_item_content_or_NULL(problem_data, FILENAME_ARCHITECTURE); -+ const char *rating_str = get_problem_item_content_or_NULL(problem_data, FILENAME_RATING); - char *full_dsc = xasprintf("Package: %s\n" - "Architecture: %s\n" - "OS Release: %s\n" -+ "rating: %s\n" - "\n" - "Comment\n" - "-----\n" - "%s\n", -- package, arch, release, comment -+ package, arch, release, rating_str, comment - ); - log(_("Adding new comment to bug %d"), bz->bi_id); - /* unused code, enable it when gui/cli will be ready -@@ -394,6 +396,19 @@ int main(int argc, char **argv) - */ - rhbz_add_comment(client, bz->bi_id, full_dsc, 0); - free(full_dsc); -+ -+ unsigned rating = xatou(rating_str); -+ if (bz->bi_best_bt_rating < rating) -+ { -+ char bug_id_str[sizeof(int)*3 + 2]; -+ sprintf(bug_id_str, "%i", bz->bi_id); -+ -+ const char *bt = get_problem_item_content_or_NULL(problem_data, -+ FILENAME_BACKTRACE); -+ log(_("Attaching better backtrace")); -+ rhbz_attach_blob(client, FILENAME_BACKTRACE, bug_id_str, bt, strlen(bt), -+ RHBZ_NOMAIL_NOTIFY); -+ } - } - } - -diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c -index 13957b8..6b71202 100644 ---- a/src/plugins/rhbz.c -+++ b/src/plugins/rhbz.c -@@ -42,14 +42,62 @@ void free_bug_info(struct bug_info *bi) - - list_free_with_free(bi->bi_cc_list); - -- bi->bi_status = NULL; -- bi->bi_resolution = NULL; -- bi->bi_reporter = NULL; -- bi->bi_product = NULL; -+ free(bi); -+} - -- bi->bi_cc_list = NULL; -+static unsigned find_best_bt_rating_in_comments(xmlrpc_value *result_xml) -+{ -+ xmlrpc_value *comments_memb = rhbz_get_member("longdescs", result_xml); -+ if (!comments_memb) -+ return 0; - -- free(bi); -+ int comments_memb_size = rhbz_array_size(comments_memb); -+ -+ xmlrpc_env env; -+ xmlrpc_env_init(&env); -+ int best_bt_rating = 0; -+ for (int i = 0; i < comments_memb_size; ++i) -+ { -+ xmlrpc_value* item = NULL; -+ xmlrpc_array_read_item(&env, comments_memb, i, &item); -+ if (env.fault_occurred) -+ abrt_xmlrpc_die(&env); -+ -+ char *comment_body = rhbz_bug_read_item("body", item, RHBZ_READ_STR); -+ /* attachments are sometimes without comments -- skip them */ -+ if (!comment_body) -+ continue; -+ -+ char *start_rating_line = strstr(comment_body, "rating: "); -+ if (!start_rating_line) -+ { -+ VERB3 error_msg("comment does not contain rating"); -+ continue; -+ } -+ -+ start_rating_line += strlen("rating: "); -+ char *end_rating_line = strchr(start_rating_line, '\n'); -+ if (!end_rating_line) -+ VERB3 error_msg("broken comment body"); -+ -+ char *rating_srt = xstrndup(start_rating_line, end_rating_line - start_rating_line); -+ int old_errno = errno; -+ errno = 0; -+ char *e; -+ long rating = strtoul(rating_srt, &e, 10); -+ if (errno || rating_srt == e || *e != '\0' || rating > UINT_MAX) -+ { -+ /* error / no digits / illegal trailing chars */ -+ errno = old_errno; -+ continue; -+ } -+ errno = old_errno; /* Ok. So restore errno. */ -+ -+ if (rating > best_bt_rating) -+ best_bt_rating = rating; -+ } -+ -+ return best_bt_rating; - } - - void rhbz_login(struct abrt_xmlrpc *ax, const char* login, const char* passwd) -@@ -273,6 +321,8 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id) - - bz->bi_cc_list = rhbz_bug_cc(xml_bug_response); - -+ bz->bi_best_bt_rating = find_best_bt_rating_in_comments(xml_bug_response); -+ - xmlrpc_DECREF(xml_bug_response); - - return bz; -diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h -index 864f603..9878dd7 100644 ---- a/src/plugins/rhbz.h -+++ b/src/plugins/rhbz.h -@@ -48,6 +48,7 @@ enum { - struct bug_info { - int bi_id; - int bi_dup_id; -+ unsigned bi_best_bt_rating; - - char *bi_status; - char *bi_resolution; --- -1.7.7.3 - diff --git a/0003-search-only-by-duphash-for-selinux.patch b/0003-search-only-by-duphash-for-selinux.patch deleted file mode 100644 index 236a4d8..0000000 --- a/0003-search-only-by-duphash-for-selinux.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 8bf23a12caac293637060b09f733f57f839a4a71 Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Wed, 30 Nov 2011 19:18:20 +0100 -Subject: [PATCH 3/6] search only by duphash for selinux - -selinux guy's almost always move filled bug from component selinux-policy -to right component. - -bugzilla client is looking for duplicate bug by sending xmlrpc query - -"ALL whiteboard: component: [product:]" - -so if bug is moved from component selinux-policy to other, then query -returns NULL and creates a new bug. - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/reporter-bugzilla.c | 25 ++++++++++++++++++------- - src/plugins/rhbz.c | 21 ++++++++++++--------- - 2 files changed, 30 insertions(+), 16 deletions(-) - -diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c -index 4739c2e..b6356f9 100644 ---- a/src/plugins/reporter-bugzilla.c -+++ b/src/plugins/reporter-bugzilla.c -@@ -280,11 +280,22 @@ int main(int argc, char **argv) - free(version); - - log(_("Checking for duplicates")); -- xmlrpc_value *result; -- if (strcmp(product, "Fedora") == 0) -- result = rhbz_search_duphash(client, component, product, duphash); -- else -- result = rhbz_search_duphash(client, component, NULL, duphash); -+ -+ /* -+ selinux guy's almost always move filled bug from component selinux-policy -+ to right component. -+ -+ bugzilla client is looking for duplicate bug by sending xmlrpc query -+ -+ "ALL whiteboard: component: [product:]" -+ -+ so if bug is moved from component selinux-policy to other, then query -+ returns NULL and creates a new bug. -+ */ -+ const char *product_substitute = (!strcmp(product, "Fedora")) ? product : NULL; -+ const char *component_substitute = (!strcmp(component, "selinux-policy")) ? NULL : component; -+ xmlrpc_value *result = rhbz_search_duphash(client, component_substitute, -+ product_substitute, duphash); - - xmlrpc_value *all_bugs = rhbz_get_member("bugs", result); - xmlrpc_DECREF(result); -@@ -310,8 +321,8 @@ int main(int argc, char **argv) - /* found something, but its a different product */ - free_bug_info(bz); - -- xmlrpc_value *result = rhbz_search_duphash(client, component, -- product, duphash); -+ xmlrpc_value *result = rhbz_search_duphash(client, component_substitute, -+ product_substitute, duphash); - xmlrpc_value *all_bugs = rhbz_get_member("bugs", result); - xmlrpc_DECREF(result); - -diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c -index 6b71202..3662816 100644 ---- a/src/plugins/rhbz.c -+++ b/src/plugins/rhbz.c -@@ -116,17 +116,20 @@ void rhbz_login(struct abrt_xmlrpc *ax, const char* login, const char* passwd) - xmlrpc_value *rhbz_search_duphash(struct abrt_xmlrpc *ax, const char *component, - const char *product, const char *duphash) - { -- char *query = NULL; -- if (!product) -- query = xasprintf("ALL component:\"%s\" whiteboard:\"%s\"", component, duphash); -- else -- query = xasprintf("ALL component:\"%s\" whiteboard:\"%s\" product:\"%s\"", -- component, duphash, product); -+ struct strbuf *query = strbuf_new(); -+ strbuf_append_strf(query, "ALL whiteboard:\"%s\"", duphash); -+ -+ if (product) -+ strbuf_append_strf(query, " product:\"%s\"", product); - -- VERB3 log("search for '%s'", query); -+ if (component) -+ strbuf_append_strf(query, " component:\"%s\"", component); -+ -+ VERB3 log("search for '%s'", query->buf); - xmlrpc_value *ret = abrt_xmlrpc_call(ax, "Bug.search", "({s:s})", -- "quicksearch", query); -- free(query); -+ "quicksearch", query->buf); -+ strbuf_free(query); -+ - return ret; - } - --- -1.7.7.3 - diff --git a/0004-reorganize-comments-for-bugzilla-message-body-comes-.patch b/0004-reorganize-comments-for-bugzilla-message-body-comes-.patch deleted file mode 100644 index cf64f89..0000000 --- a/0004-reorganize-comments-for-bugzilla-message-body-comes-.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 51a3918434aec04d057bf5a0d117214c9e6d9413 Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Wed, 30 Nov 2011 19:57:58 +0100 -Subject: [PATCH 4/6] reorganize comments for bugzilla -- message body comes - first - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/reporter-bugzilla.c | 22 ++++++++++------------ - 1 files changed, 10 insertions(+), 12 deletions(-) - -diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c -index b6356f9..e150944 100644 ---- a/src/plugins/reporter-bugzilla.c -+++ b/src/plugins/reporter-bugzilla.c -@@ -389,24 +389,22 @@ int main(int argc, char **argv) - const char *package = get_problem_item_content_or_NULL(problem_data, FILENAME_PACKAGE); - const char *arch = get_problem_item_content_or_NULL(problem_data, FILENAME_ARCHITECTURE); - const char *rating_str = get_problem_item_content_or_NULL(problem_data, FILENAME_RATING); -- char *full_dsc = xasprintf("Package: %s\n" -- "Architecture: %s\n" -- "OS Release: %s\n" -- "rating: %s\n" -- "\n" -- "Comment\n" -- "-----\n" -- "%s\n", -- package, arch, release, rating_str, comment -- ); -+ -+ struct strbuf *full_desc = strbuf_new(); -+ strbuf_append_strf(full_desc, "%s\n\n", comment); -+ strbuf_append_strf(full_desc, "rating: %s\n", rating_str); -+ strbuf_append_strf(full_desc, "Package: %s\n", package); -+ strbuf_append_strf(full_desc, "Architecture: %s\n", arch); -+ strbuf_append_strf(full_desc, "OS Release: %s\n", release); -+ - log(_("Adding new comment to bug %d"), bz->bi_id); - /* unused code, enable it when gui/cli will be ready - int is_priv = is_private && string_to_bool(is_private); - const char *is_private = get_problem_item_content_or_NULL(problem_data, - "is_private"); - */ -- rhbz_add_comment(client, bz->bi_id, full_dsc, 0); -- free(full_dsc); -+ rhbz_add_comment(client, bz->bi_id, full_desc->buf, 0); -+ strbuf_free(full_desc); - - unsigned rating = xatou(rating_str); - if (bz->bi_best_bt_rating < rating) --- -1.7.7.3 - diff --git a/0005-do-not-insert-duplicate-comment-to-bugzilla.patch b/0005-do-not-insert-duplicate-comment-to-bugzilla.patch deleted file mode 100644 index 5811d04..0000000 --- a/0005-do-not-insert-duplicate-comment-to-bugzilla.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 9786e890de57260d2975a605512147779383c137 Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Thu, 1 Dec 2011 14:48:48 +0100 -Subject: [PATCH 5/6] do not insert duplicate comment to bugzilla - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/reporter-bugzilla.c | 11 +++++-- - src/plugins/rhbz.c | 60 +++++++++++++++++++++++++++++++++++---- - src/plugins/rhbz.h | 3 ++ - 3 files changed, 65 insertions(+), 9 deletions(-) - -diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c -index e150944..9bdadba 100644 ---- a/src/plugins/reporter-bugzilla.c -+++ b/src/plugins/reporter-bugzilla.c -@@ -397,17 +397,22 @@ int main(int argc, char **argv) - strbuf_append_strf(full_desc, "Architecture: %s\n", arch); - strbuf_append_strf(full_desc, "OS Release: %s\n", release); - -- log(_("Adding new comment to bug %d"), bz->bi_id); - /* unused code, enable it when gui/cli will be ready - int is_priv = is_private && string_to_bool(is_private); - const char *is_private = get_problem_item_content_or_NULL(problem_data, - "is_private"); - */ -- rhbz_add_comment(client, bz->bi_id, full_desc->buf, 0); -+ -+ int allow_comment = is_comment_dup(bz->bi_comments, full_desc->buf); -+ if (!allow_comment) -+ { -+ log(_("Adding new comment to bug %d"), bz->bi_id); -+ rhbz_add_comment(client, bz->bi_id, full_desc->buf, 0); -+ } - strbuf_free(full_desc); - - unsigned rating = xatou(rating_str); -- if (bz->bi_best_bt_rating < rating) -+ if (!allow_comment && (bz->bi_best_bt_rating < rating)) - { - char bug_id_str[sizeof(int)*3 + 2]; - sprintf(bug_id_str, "%i", bz->bi_id); -diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c -index 3662816..4c3c91f 100644 ---- a/src/plugins/rhbz.c -+++ b/src/plugins/rhbz.c -@@ -45,17 +45,17 @@ void free_bug_info(struct bug_info *bi) - free(bi); - } - --static unsigned find_best_bt_rating_in_comments(xmlrpc_value *result_xml) -+static GList *parse_comments(xmlrpc_value *result_xml) - { -+ GList *comments = NULL; - xmlrpc_value *comments_memb = rhbz_get_member("longdescs", result_xml); - if (!comments_memb) -- return 0; -+ return NULL; - - int comments_memb_size = rhbz_array_size(comments_memb); - - xmlrpc_env env; - xmlrpc_env_init(&env); -- int best_bt_rating = 0; - for (int i = 0; i < comments_memb_size; ++i) - { - xmlrpc_value* item = NULL; -@@ -65,8 +65,55 @@ static unsigned find_best_bt_rating_in_comments(xmlrpc_value *result_xml) - - char *comment_body = rhbz_bug_read_item("body", item, RHBZ_READ_STR); - /* attachments are sometimes without comments -- skip them */ -- if (!comment_body) -- continue; -+ if (comment_body) -+ comments = g_list_prepend(comments, comment_body); -+ } -+ -+ return g_list_reverse(comments); -+} -+ -+static char *trim_all_whitespace(const char *str) -+{ -+ char *trim = xzalloc(sizeof(char) * strlen(str) + 1); -+ int i = 0; -+ while (*str) -+ { -+ if (!isspace(*str)) -+ trim[i++] = *str; -+ str++; -+ } -+ -+ return trim; -+} -+ -+int is_comment_dup(GList *comments, const char *comment) -+{ -+ for (GList *l = comments; l; l = l->next) -+ { -+ char *comment_body = (char *) l->data; -+ char *trim_comment_body = trim_all_whitespace(comment_body); -+ char *trim_comment = trim_all_whitespace(comment); -+ if (!strcmp(trim_comment_body, trim_comment)) -+ { -+ free(trim_comment_body); -+ free(trim_comment); -+ return 1; -+ } -+ } -+ -+ return 0;; -+} -+ -+static unsigned find_best_bt_rating_in_comments(GList *comments) -+{ -+ if (!comments) -+ return 0; -+ -+ int best_bt_rating = 0; -+ -+ for (GList *l = comments; l; l = l->next) -+ { -+ char *comment_body = (char *) l->data; - - char *start_rating_line = strstr(comment_body, "rating: "); - if (!start_rating_line) -@@ -324,7 +371,8 @@ struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id) - - bz->bi_cc_list = rhbz_bug_cc(xml_bug_response); - -- bz->bi_best_bt_rating = find_best_bt_rating_in_comments(xml_bug_response); -+ bz->bi_comments = parse_comments(xml_bug_response); -+ bz->bi_best_bt_rating = find_best_bt_rating_in_comments(bz->bi_comments); - - xmlrpc_DECREF(xml_bug_response); - -diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h -index 9878dd7..141db7d 100644 ---- a/src/plugins/rhbz.h -+++ b/src/plugins/rhbz.h -@@ -56,6 +56,7 @@ struct bug_info { - char *bi_product; - - GList *bi_cc_list; -+ GList *bi_comments; - }; - - struct bug_info *new_bug_info(); -@@ -94,6 +95,8 @@ int rhbz_attach_blob(struct abrt_xmlrpc *ax, const char *filename, - int rhbz_attach_fd(struct abrt_xmlrpc *ax, const char *filename, - const char *bug_id, int fd, int flags); - -+int is_comment_dup(GList *comments, const char *comment); -+ - GList *rhbz_bug_cc(xmlrpc_value *result_xml); - - struct bug_info *rhbz_bug_info(struct abrt_xmlrpc *ax, int bug_id); --- -1.7.7.3 - diff --git a/0006-if-OSRelease-environ-is-empty-load-OSRelease-from-pr.patch b/0006-if-OSRelease-environ-is-empty-load-OSRelease-from-pr.patch deleted file mode 100644 index bea7fb2..0000000 --- a/0006-if-OSRelease-environ-is-empty-load-OSRelease-from-pr.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7e9ef41bcb10d13d550d6f983c9872d9c1fe19d5 Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Wed, 7 Dec 2011 14:53:04 +0100 -Subject: [PATCH 6/6] if OSRelease environ is empty, load OSRelease from - problem-dir - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/reporter-bugzilla.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c -index 9bdadba..001cbd9 100644 ---- a/src/plugins/reporter-bugzilla.c -+++ b/src/plugins/reporter-bugzilla.c -@@ -265,7 +265,7 @@ int main(int argc, char **argv) - const char *duphash = get_problem_item_content_or_NULL(problem_data, FILENAME_DUPHASH); - //COMPAT, remove after 2.1 release - if (!duphash) duphash = get_problem_item_content_or_die(problem_data, "global_uuid"); -- if (!release) /* if not overridden... */ -+ if (!release || !*release) /* if not overridden or empty... */ - { - release = get_problem_item_content_or_NULL(problem_data, FILENAME_OS_RELEASE); - //COMPAT, remove in abrt-2.1 --- -1.7.7.3 - diff --git a/0009-bodhi-sync-enum-with-parse_opt.patch b/0009-bodhi-sync-enum-with-parse_opt.patch deleted file mode 100644 index 9394f95..0000000 --- a/0009-bodhi-sync-enum-with-parse_opt.patch +++ /dev/null @@ -1,40 +0,0 @@ -From ba84c2b51b2c14a5a97a575b9019d0057bf88782 Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Thu, 8 Dec 2011 16:53:40 +0100 -Subject: [PATCH 09/11] bodhi: sync enum with parse_opt - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/abrt-bodhi.c | 9 ++++++--- - 1 files changed, 6 insertions(+), 3 deletions(-) - -diff --git a/src/plugins/abrt-bodhi.c b/src/plugins/abrt-bodhi.c -index a2c1445..5416a0a 100644 ---- a/src/plugins/abrt-bodhi.c -+++ b/src/plugins/abrt-bodhi.c -@@ -110,7 +110,7 @@ - } - */ - --static const char *bodhi_url = "https://admin.fedoraproject.org/updates/"; -+static const char *bodhi_url = "https://admin.fedoraproject.org/updates"; - - struct bodhi { - char *nvr; -@@ -356,8 +356,11 @@ int main(int argc, char **argv) - abrt_init(argv); - enum { - OPT_v = 1 << 0, -- OPT_b = 1 << 1, -- OPT_r = 1 << 2, -+ OPT_d = 1 << 1, -+ OPT_g = 1 << 2, -+ OPT_b = 1 << 3, -+ OPT_u = 1 << 4, -+ OPT_r = 1 << 5, - }; - - const char *bugs = NULL, *release = NULL, *dump_dir_path = "."; --- -1.7.7.3 - diff --git a/0010-inicializing-rpm-more-then-once-leads-to-sigsegv-in-.patch b/0010-inicializing-rpm-more-then-once-leads-to-sigsegv-in-.patch deleted file mode 100644 index 45b78a0..0000000 --- a/0010-inicializing-rpm-more-then-once-leads-to-sigsegv-in-.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0580662e90789a45f657b017fd0ae621d8ea4f6a Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Thu, 8 Dec 2011 17:15:02 +0100 -Subject: [PATCH 10/11] inicializing rpm more then once leads to sigsegv in - rpmReadConfigFiles - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/abrt-bodhi.c | 4 ++++ - 1 files changed, 4 insertions(+), 0 deletions(-) - -diff --git a/src/plugins/abrt-bodhi.c b/src/plugins/abrt-bodhi.c -index 5416a0a..11c6d02 100644 ---- a/src/plugins/abrt-bodhi.c -+++ b/src/plugins/abrt-bodhi.c -@@ -348,6 +348,10 @@ error: - rpmdbFreeIterator(iter); - rpmtsFree(ts); - -+ rpmFreeRpmrc(); -+ rpmFreeCrypto(); -+ rpmFreeMacros(NULL); -+ - return nvr; - } - --- -1.7.7.3 - diff --git a/0011-url-takes-escaped-string.patch b/0011-url-takes-escaped-string.patch deleted file mode 100644 index e4e5e1f..0000000 --- a/0011-url-takes-escaped-string.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 02ab44ad63b5d6261bdedc12cad4022333018316 Mon Sep 17 00:00:00 2001 -From: Nikola Pajkovsky -Date: Thu, 8 Dec 2011 17:35:37 +0100 -Subject: [PATCH 11/11] url takes escaped string - -Signed-off-by: Nikola Pajkovsky ---- - src/plugins/abrt-bodhi.c | 6 +++++- - 1 files changed, 5 insertions(+), 1 deletions(-) - -diff --git a/src/plugins/abrt-bodhi.c b/src/plugins/abrt-bodhi.c -index 11c6d02..43a3b42 100644 ---- a/src/plugins/abrt-bodhi.c -+++ b/src/plugins/abrt-bodhi.c -@@ -421,7 +421,11 @@ int main(int argc, char **argv) - } - - if (argv[optind]) -- query = strbuf_append_strf(query, "package=%s&", argv[optind]); -+ { -+ char *escaped = g_uri_escape_string(argv[optind], NULL, 0); -+ query = strbuf_append_strf(query, "package=%s&", escaped); -+ free(escaped); -+ } - - if (query->buf[query->len - 1] == '&') - query->buf[query->len - 1] = '\0'; --- -1.7.7.3 - diff --git a/libreport.spec b/libreport.spec index 9955492..4d93830 100644 --- a/libreport.spec +++ b/libreport.spec @@ -5,7 +5,7 @@ Summary: Generic library for reporting various problems Name: libreport Version: 2.0.10 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: System Environment/Libraries URL: https://fedorahosted.org/abrt/ @@ -376,6 +376,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %config(noreplace) %{_sysconfdir}/libreport/events.d/uploader_event.conf %changelog +* Mon May 14 2012 Jiri Moskovcak 2.0.10-3 +- fixed compatibility with bugzilla 4.2 +- Resolved: #820985, #795548 + * Mon Apr 02 2012 Jiri Moskovcak 2.0.10-2 - added cgroups filename define