From ef5d23d3b1f757c1a09f30b77bb969041173ca7c Mon Sep 17 00:00:00 2001 From: Matej Habrnal Date: Wed, 26 Aug 2015 16:52:35 +0200 Subject: [PATCH] Bug fixes - introduce bodhi2 to abrt-bodhi - don't start reporting of not-reportable problems - add hawkey to BRs of abrt-bodhi - add bash on the package blacklist Resolves #1250379 Signed-off-by: Matej Habrnal --- ...-d-add-bash-on-the-package-blacklist.patch | 31 ++ ...reporting-of-not-reportable-problems.patch | 45 +++ ...nvert-all-ex.message-stmts-to-str-ex.patch | 85 +++++ 0033-introduce-bodhi2-to-abrt-bodhi.patch | 317 ++++++++++++++++++ ...break-the-reporting-if-a-bodhi-fails.patch | 28 ++ 0036-bodhi-add-ignoring-of-Rawhide.patch | 53 +++ ...bodhi-add-parsing-of-error-responses.patch | 110 ++++++ abrt.spec | 27 +- 8 files changed, 694 insertions(+), 2 deletions(-) create mode 100644 0028-a-a-s-p-d-add-bash-on-the-package-blacklist.patch create mode 100644 0029-cli-don-t-start-reporting-of-not-reportable-problems.patch create mode 100644 0032-convert-all-ex.message-stmts-to-str-ex.patch create mode 100644 0033-introduce-bodhi2-to-abrt-bodhi.patch create mode 100644 0035-ccpp-do-not-break-the-reporting-if-a-bodhi-fails.patch create mode 100644 0036-bodhi-add-ignoring-of-Rawhide.patch create mode 100644 0037-bodhi-add-parsing-of-error-responses.patch diff --git a/0028-a-a-s-p-d-add-bash-on-the-package-blacklist.patch b/0028-a-a-s-p-d-add-bash-on-the-package-blacklist.patch new file mode 100644 index 0000000..71250b0 --- /dev/null +++ b/0028-a-a-s-p-d-add-bash-on-the-package-blacklist.patch @@ -0,0 +1,31 @@ +From 5938d89ac666e825aa880691fc109ae79b848f7a Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Thu, 20 Aug 2015 09:40:59 +0200 +Subject: [PATCH] a-a-s-p-d: add bash on the package blacklist + +In case of this package, the reported data doesn't yield sufficient information +to solve a bug. + +Related to rhbz#1250379 + +Signed-off-by: Matej Habrnal +--- + src/daemon/abrt-action-save-package-data.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/daemon/abrt-action-save-package-data.conf b/src/daemon/abrt-action-save-package-data.conf +index 27b9607..0129399 100644 +--- a/src/daemon/abrt-action-save-package-data.conf ++++ b/src/daemon/abrt-action-save-package-data.conf +@@ -7,7 +7,7 @@ OpenGPGCheck = yes + + # Blacklisted packages + # +-BlackList = nspluginwrapper, valgrind, strace, mono-core, firefox ++BlackList = nspluginwrapper, valgrind, strace, mono-core, firefox, bash + + # Process crashes in executables which do not belong to any package? + # +-- +2.5.0 + diff --git a/0029-cli-don-t-start-reporting-of-not-reportable-problems.patch b/0029-cli-don-t-start-reporting-of-not-reportable-problems.patch new file mode 100644 index 0000000..da7d8a1 --- /dev/null +++ b/0029-cli-don-t-start-reporting-of-not-reportable-problems.patch @@ -0,0 +1,45 @@ +From 37794a0573fd7b3586e72071d27f27f173459142 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Thu, 20 Aug 2015 11:15:59 +0200 +Subject: [PATCH] cli: don't start reporting of not-reportable problems + +If the reported problem data contains 'not-reportable' element, the +reporting process fails unexpectedly and after the reporter already spent some +time on it. + +This commit ensures that the reporting process won't start, so +abrt-cli's behaviour will be consistent with ABRT GUI. + +However, this is not an ideal solution because we might want to allow +the reporter to report the problem directly to developers via e-mail. + +Closes #986 + +Signed-off-by: Jakub Filak +--- + src/cli/report.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/cli/report.c b/src/cli/report.c +index 19b4c51..cc4035e 100644 +--- a/src/cli/report.c ++++ b/src/cli/report.c +@@ -36,6 +36,15 @@ int _cmd_report(const char **dirs_strv, int remove) + continue; + } + ++ const int not_reportable = test_exist_over_dbus(real_problem_id, FILENAME_NOT_REPORTABLE); ++ if (not_reportable != 0) ++ { ++ error_msg(_("Problem '%s' cannot be reported"), real_problem_id); ++ free(real_problem_id); ++ ++ret; ++ continue; ++ } ++ + const int res = chown_dir_over_dbus(real_problem_id); + if (res != 0) + { +-- +2.5.0 + diff --git a/0032-convert-all-ex.message-stmts-to-str-ex.patch b/0032-convert-all-ex.message-stmts-to-str-ex.patch new file mode 100644 index 0000000..3d866bd --- /dev/null +++ b/0032-convert-all-ex.message-stmts-to-str-ex.patch @@ -0,0 +1,85 @@ +From fe4196bd067e938303ec3cdee7c912e84cea6aa0 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Tue, 25 Aug 2015 08:25:19 +0200 +Subject: [PATCH] convert all 'ex.message' stmts to 'str(ex)' + +Python 3 exceptions do not have the 'message' attribute. +The 'message' attribute has been deprecated since Python 2.6 +https://www.python.org/dev/peps/pep-0352/ + +Signed-off-by: Jakub Filak +--- + src/plugins/abrt-action-generate-machine-id | 2 +- + src/plugins/abrt-action-notify | 12 ++++++------ + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/src/plugins/abrt-action-generate-machine-id b/src/plugins/abrt-action-generate-machine-id +index 63b5c93..c547d7c 100644 +--- a/src/plugins/abrt-action-generate-machine-id ++++ b/src/plugins/abrt-action-generate-machine-id +@@ -110,7 +110,7 @@ def generate_machine_id(generators): + ids[sd] = workers[sd]() + except RuntimeError as ex: + logging.error("Machine-ID generator '{0}' failed: {1}" +- .format(sd, ex.message)) ++ .format(sd, str(ex))) + + return ids + +diff --git a/src/plugins/abrt-action-notify b/src/plugins/abrt-action-notify +index 716de45..ca8f807 100644 +--- a/src/plugins/abrt-action-notify ++++ b/src/plugins/abrt-action-notify +@@ -116,7 +116,7 @@ def emit_crash_dbus_signal(problem_data): + bus.send_message(msg) + except dbus.exceptions.DBusException as ex: + raise RuntimeError("Failed to emit D-Bus Crash signal: {0}" +- .format(ex.message)) ++ .format(str(ex))) + finally: + if bus is not None: + bus.close() +@@ -213,7 +213,7 @@ if __name__ == "__main__": + PD = build_notification_problem_data(DIR_PATH) + except ValueError as ex: + sys.stderr.write("Cannot notify '{0}': {1}\n". +- format(DIR_PATH, ex.message)) ++ format(DIR_PATH, str(ex))) + sys.exit(RETURN_FAILURE) + + # The execution must continue because we should try to notify via all +@@ -223,13 +223,13 @@ if __name__ == "__main__": + emit_crash_dbus_signal(PD) + except RuntimeError as ex: + sys.stderr.write("Cannot notify '{0}' via D-Bus: {1}\n". +- format(DIR_PATH, ex.message)) ++ format(DIR_PATH, str(ex))) + return_status = RETURN_FAILURE + except KeyError as ex: + # this is a bug in build_notification_problem_data() + sys.stderr.write("BUG: problem data misses required element '{0}'" + " required for D-Bus notification\n" +- .format(ex.message)) ++ .format(str(ex))) + + return_status = RETURN_FAILURE + +@@ -247,13 +247,13 @@ if __name__ == "__main__": + run_autoreport(PD, event_name) + except RuntimeError as ex: + sys.stderr.write("Cannot notify '{0}' via uReport: {1}\n". +- format(DIR_PATH, ex.message)) ++ format(DIR_PATH, str(ex))) + return_status = RETURN_FAILURE + except KeyError as ex: + # this is a bug in build_notification_problem_data() + sys.stderr.write( + "BUG: problem data misses required element '{0}'" +- " required for uReport notification\n".format(ex.message)) ++ " required for uReport notification\n".format(str(ex))) + + return_status = RETURN_FAILURE + +-- +2.5.0 + diff --git a/0033-introduce-bodhi2-to-abrt-bodhi.patch b/0033-introduce-bodhi2-to-abrt-bodhi.patch new file mode 100644 index 0000000..e8a6df0 --- /dev/null +++ b/0033-introduce-bodhi2-to-abrt-bodhi.patch @@ -0,0 +1,317 @@ +From 084a2aaa6373f178d6bf1ac66c196476d2faa438 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Tue, 25 Aug 2015 16:03:51 +0200 +Subject: [PATCH] introduce bodhi2 to abrt-bodhi + +Resolves: rhbz#1256493 + +Signed-off-by: Jakub Filak +--- + configure.ac | 1 + + src/plugins/Makefile.am | 2 + + src/plugins/bodhi.c | 197 +++++++++++++++++++++++++++--------------------- + 3 files changed, 114 insertions(+), 86 deletions(-) + +diff --git a/configure.ac b/configure.ac +index b372e12..1013e3b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -376,6 +376,7 @@ PKG_CHECK_MODULES([JSON_C], [json], [ + if test -z "$NO_BODHI" + then + PKG_CHECK_MODULES([LIBREPORT_WEB], [libreport-web]) ++PKG_CHECK_MODULES([HAWKEY], [hawkey]) + AM_CONDITIONAL(BUILD_BODHI, true) + else + AM_CONDITIONAL(BUILD_BODHI, false) +diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am +index aa426ff..1c1ff8a 100644 +--- a/src/plugins/Makefile.am ++++ b/src/plugins/Makefile.am +@@ -366,10 +366,12 @@ abrt_bodhi_SOURCES = \ + $(LIBREPORT_WEB_CFLAGS) \ + $(JSON_C_CFLAGS) \ + $(RPM_CFLAGS) \ ++ $(HAWKEY_CFLAGS) \ + -D_GNU_SOURCE + abrt_bodhi_LDADD = \ + $(JSON_C_LIBS) \ + $(RPM_LIBS) \ ++ $(HAWKEY_LIBS) \ + $(LIBREPORT_LIBS) \ + $(LIBREPORT_WEB_LIBS) + endif +diff --git a/src/plugins/bodhi.c b/src/plugins/bodhi.c +index fcdbd83..831f5ff 100644 +--- a/src/plugins/bodhi.c ++++ b/src/plugins/bodhi.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -32,85 +33,103 @@ + /* bodhi returns json structure + + { +- "num_items":2, +- "title":"2 updats found", +- "tg_flash":null, +- "updates":[ +- { +- "status":"stable", +- "close_bugs":true, +- "request":null, +- "date_submitted":"2011-03-18 17:25:14", +- "unstable_karma":-3, +- "submitter":"twaugh", +- "critpath":false, +- "approved":null, +- "stable_karma":2, +- "date_pushed":"2011-03-19 05:34:27", +- "builds":[ +- { +- "nvr":"system-config-printer-1.3.2-1.fc15", +- "package":{ +- "suggest_reboot":false, +- "committers":[ +- "twaugh", +- "jpopelka" +- ], +- "name":"system-config-printer" +- } +- }, +- { +- .... +- } +- ], +- "title":"system-config-printer-1.3.2-1.fc15", +- "notes":"This update fixes several bugs and re-enables translations that were accidentally disabled.", +- "date_modified":null, +- "nagged":null, +- "bugs":[ +- { +- "bz_id":685098, +- "security":false, +- "parent":false, +- "title":"[abrt] system-config-printer-1.3.1-1.fc15: authconn.py:197:_connect:RuntimeError: failed to connect to server" +- }, +- { +- ... +- } +- ], +- "comments":[ +- { +- "group":null, +- "karma":0, +- "anonymous":false, +- "author":"bodhi", +- "timestamp":"2011-03-18 17:26:34", +- "text":"This update has been submitted for testing by twaugh. " +- }, +- { +- ... +- } +- ], +- "critpath_approved":false, +- "updateid":"FEDORA-2011-3596", +- "karma":0, +- "release":{ +- "dist_tag":"dist-f15", +- "id_prefix":"FEDORA", +- "locked":false, +- "name":"F15", +- "long_name":"Fedora 15" +- }, +- "type":"bugfix" +- }, +- { +- ... +- } +- ] ++ "rows_per_page": 20, ++ "total": 1, ++ "chrome": true, ++ "display_user": true, ++ "pages": 1, ++ "updates": [ ++ { ++ "close_bugs": true, ++ "old_updateid": "FEDORA-2015-13720", ++ "pushed": true, ++ "require_testcases": false, ++ "critpath": false, ++ "date_approved": null, ++ "stable_karma": null, ++ "date_pushed": "2015-08-19 04:49:00", ++ "requirements": null, ++ "severity": "unspecified", ++ "title": "hwloc-1.11.0-3.fc22", ++ "suggest": "unspecified", ++ "require_bugs": false, ++ "comments": [ ++ { ++ "bug_feedback": [], ++ "user_id": 91, ++ "text": "This update has been submitted for testing by jhladky. ", ++ "testcase_feedback": [], ++ "karma_critpath": 0, ++ "update": 21885, ++ "update_id": 21885, ++ "karma": 0, ++ "anonymous": false, ++ "timestamp": "2015-08-18 13:38:35", ++ "id": 166016, ++ "user": {"stacks": [], ++ "name": "bodhi", ++ "avatar": "https://apps.fedoraproject.org/img/icons/bodhi-24.png"} ++ }, ++ { ++ ... ++ } ++ ], ++ "updateid": "FEDORA-2015-13720", ++ "cves": [], ++ "type": "bugfix", ++ "status": "testing", ++ "date_submitted": "2015-08-18 13:37:26", ++ "unstable_karma": null, ++ "submitter": "jhladky", ++ "user": ++ { ++ "stacks": [], ++ "buildroot_overrides": [], ++ "name": "jhladky", ++ "avatar": "https://seccdn.libravatar.org/avatar/b838b78fcf707a13cdaeb1c846d514e614d617cbf2c106718e71cb397607f59b?s=24&d=retro" ++ }, ++ "locked": false, ++ "builds": [{"override": null, ++ "nvr": "hwloc-1.11.0-3.fc22"}], ++ "date_modified": null, ++ "test_cases": [], ++ "notes": "Fix for BZ1253977", ++ "request": null, ++ "bugs": [ ++ { ++ "bug_id": 1253977, ++ "security": false, ++ "feedback": [], ++ "parent": false, ++ "title": "conflict between hwloc-libs-1.11.0-1.fc22.i686 and hwloc-libs-1.11.0-1.fc22.x86_64" ++ } ++ ], ++ "alias": "FEDORA-2015-13720", ++ "karma": 0, ++ "release": ++ { ++ "dist_tag": "f22", ++ "name": "F22", ++ "testing_tag": "f22-updates-testing", ++ "pending_stable_tag": "f22-updates-pending", ++ "long_name": "Fedora 22", ++ "state": "current", ++ "version": "22", ++ "override_tag": "f22-override", ++ "branch": "f22", ++ "id_prefix": "FEDORA", ++ "pending_testing_tag": "f22-updates-testing-pending", ++ "stable_tag": "f22-updates", ++ "candidate_tag": "f22-updates-candidate" ++ } ++ } ++ ], ++ "display_request": true, ++ "page": 1 + } + */ + +-static const char *bodhi_url = "https://admin.fedoraproject.org/updates"; ++static const char *bodhi_url = "https://bodhi.fedoraproject.org/updates"; + + struct bodhi { + char *nvr; +@@ -202,7 +221,7 @@ static GHashTable *bodhi_parse_json(json_object *json, const char *release) + { + + int num_items = 0; +- bodhi_read_value(json, "num_items", &num_items, BODHI_READ_INT); ++ bodhi_read_value(json, "total", &num_items, BODHI_READ_INT); + if (num_items <= 0) + return NULL; + +@@ -241,13 +260,19 @@ static GHashTable *bodhi_parse_json(json_object *json, const char *release) + b = xzalloc(sizeof(struct bodhi)); + + char *name = NULL; ++ long ign_e; ++ char *ign_v, *ign_r, *ign_a; ++ + json_object *build = json_object_array_get_idx(builds_item, k); + + bodhi_read_value(build, "nvr", &b->nvr, BODHI_READ_STR); + +- json_object *package = NULL; +- bodhi_read_value(build, "package", &package, BODHI_READ_JSON_OBJ); +- bodhi_read_value(package, "name", &name, BODHI_READ_STR); ++ if (hy_split_nevra(b->nvr, &name, &ign_e, &ign_v, &ign_r, &ign_a)) ++ error_msg_and_die("hawkey failed to parse '%s'", b->nvr); ++ ++ free(ign_v); ++ free(ign_r); ++ free(ign_a); + + struct bodhi *bodhi_tbl_item = g_hash_table_lookup(bodhi_table, name); + if (bodhi_tbl_item && rpmvercmp(bodhi_tbl_item->nvr, b->nvr) > 0) +@@ -287,7 +312,7 @@ 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("%s/list", bodhi_url); ++ char *bodhi_url_bugs = xasprintf("%s/?%s", bodhi_url, query); + + post_state_t *post_state = new_post_state(POST_WANT_BODY + | POST_WANT_SSL_VERIFY +@@ -298,8 +323,8 @@ static GHashTable *bodhi_query_list(const char *query, const char *release) + NULL + }; + +- post_string(post_state, bodhi_url_bugs, "application/x-www-form-urlencoded", +- headers, query); ++ get(post_state, bodhi_url_bugs, "application/x-www-form-urlencoded", ++ headers); + + if (post_state->http_resp_code != 200) + { +@@ -397,7 +422,7 @@ int main(int argc, char **argv) + { + if (release) + { +- query = strbuf_append_strf(query, "release=%s&", release); ++ query = strbuf_append_strf(query, "releases=%s&", release); + } + else + { +@@ -414,7 +439,7 @@ int main(int argc, char **argv) + map_string_t *osinfo = new_map_string(); + problem_data_get_osinfo(problem_data, osinfo); + parse_osinfo_for_rhts(osinfo, &product, &version); +- query = strbuf_append_strf(query, "release=f%s&", version); ++ query = strbuf_append_strf(query, "releases=f%s&", version); + free(product); + free(version); + free_map_string(osinfo); +@@ -424,7 +449,7 @@ int main(int argc, char **argv) + if (argv[optind]) + { + char *escaped = g_uri_escape_string(argv[optind], NULL, 0); +- query = strbuf_append_strf(query, "package=%s&", escaped); ++ query = strbuf_append_strf(query, "packages=%s&", escaped); + free(escaped); + } + +-- +2.5.0 + diff --git a/0035-ccpp-do-not-break-the-reporting-if-a-bodhi-fails.patch b/0035-ccpp-do-not-break-the-reporting-if-a-bodhi-fails.patch new file mode 100644 index 0000000..b50343a --- /dev/null +++ b/0035-ccpp-do-not-break-the-reporting-if-a-bodhi-fails.patch @@ -0,0 +1,28 @@ +From 7cf5d9fe151713b65314c714c9968f04367691fe Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Wed, 26 Aug 2015 08:28:07 +0200 +Subject: [PATCH] ccpp: do not break the reporting if a-bodhi fails + +Related: rhbz#1256493 + +Signed-off-by: Jakub Filak +--- + src/plugins/abrt-action-analyze-ccpp-local.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/plugins/abrt-action-analyze-ccpp-local.in b/src/plugins/abrt-action-analyze-ccpp-local.in +index de131c8..5a42a03 100644 +--- a/src/plugins/abrt-action-analyze-ccpp-local.in ++++ b/src/plugins/abrt-action-analyze-ccpp-local.in +@@ -39,7 +39,7 @@ if [ $? = 0 ]; then + bug_id=$(reporter-bugzilla -h "`cat duphash`") + if $WITH_BODHI; then + if test -n "$bug_id"; then +- abrt-bodhi -r -b $bug_id ++ abrt-bodhi -r -b $bug_id || : + fi + fi + fi +-- +2.5.0 + diff --git a/0036-bodhi-add-ignoring-of-Rawhide.patch b/0036-bodhi-add-ignoring-of-Rawhide.patch new file mode 100644 index 0000000..a93b156 --- /dev/null +++ b/0036-bodhi-add-ignoring-of-Rawhide.patch @@ -0,0 +1,53 @@ +From 783f4ea59bfcd7f563a3b0ab0012f41fcd289eff Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Wed, 26 Aug 2015 13:18:26 +0200 +Subject: [PATCH] bodhi: add ignoring of Rawhide + +Resolves: rhbz#1256493 + +Signed-off-by: Matej Habrnal +--- + src/plugins/bodhi.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/bodhi.c b/src/plugins/bodhi.c +index 831f5ff..9149347 100644 +--- a/src/plugins/bodhi.c ++++ b/src/plugins/bodhi.c +@@ -422,6 +422,10 @@ int main(int argc, char **argv) + { + if (release) + { ++ /* There are no bodhi updates for Rawhide */ ++ if (strcasecmp(release, "rawhide") == 0) ++ error_msg_and_die("Reselase \"%s\" is not supported",release); ++ + query = strbuf_append_strf(query, "releases=%s&", release); + } + else +@@ -439,10 +443,21 @@ int main(int argc, char **argv) + map_string_t *osinfo = new_map_string(); + problem_data_get_osinfo(problem_data, osinfo); + parse_osinfo_for_rhts(osinfo, &product, &version); +- query = strbuf_append_strf(query, "releases=f%s&", version); ++ ++ /* There are no bodhi updates for Rawhide */ ++ bool rawhide = strcasecmp(release, "rawhide") == 0; ++ if (!rawhide) ++ query = strbuf_append_strf(query, "releases=f%s&", version); ++ + free(product); + free(version); + free_map_string(osinfo); ++ ++ if (rawhide) ++ { ++ strbuf_free(query); ++ error_msg_and_die("Reselase \"Rawhide\" is not supported"); ++ } + } + } + +-- +2.5.0 + diff --git a/0037-bodhi-add-parsing-of-error-responses.patch b/0037-bodhi-add-parsing-of-error-responses.patch new file mode 100644 index 0000000..f783937 --- /dev/null +++ b/0037-bodhi-add-parsing-of-error-responses.patch @@ -0,0 +1,110 @@ +From 878d29d13773d035fc6a41d6b2c402f021e10dbd Mon Sep 17 00:00:00 2001 +From: Matej Habrnal +Date: Wed, 26 Aug 2015 13:41:27 +0200 +Subject: [PATCH] bodhi: add parsing of error responses + +Resolves: rhbz#1256493 + +Signed-off-by: Matej Habrnal +--- + src/plugins/bodhi.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 69 insertions(+), 1 deletion(-) + +diff --git a/src/plugins/bodhi.c b/src/plugins/bodhi.c +index 9149347..b348a26 100644 +--- a/src/plugins/bodhi.c ++++ b/src/plugins/bodhi.c +@@ -217,6 +217,58 @@ static void print_bodhi(struct bodhi *b) + } + #endif + ++/* bodhi returns following json structure in case of error ++{ ++ "status": "error", ++ "errors": ++ [ ++ { ++ "location": "querystring", ++ "name": "releases", ++ "description": "Invalid releases specified: Rawhide" ++ } ++ ] ++} ++*/ ++static void bodhi_print_errors_from_json(json_object *json) ++{ ++ ++ json_object *errors_array = NULL; ++ bodhi_read_value(json, "errors", &errors_array, BODHI_READ_JSON_OBJ); ++ if (!errors_array) ++ { ++ error_msg("Error: unable to read 'errors' array from json"); ++ return; ++ } ++ ++ int errors_len = json_object_array_length(errors_array); ++ for (int i = 0; i < errors_len; ++i) ++ { ++ json_object *error = json_object_array_get_idx(errors_array, i); ++ if (!error) ++ { ++ error_msg("Error: unable to get 'error[%d]'", i); ++ json_object_put(errors_array); ++ return; ++ } ++ ++ char *desc_item = NULL; ++ bodhi_read_value(error, "description", &desc_item, BODHI_READ_STR); ++ if (!desc_item) ++ { ++ error_msg("Error: unable to get 'description' from 'error[%d]'", i); ++ continue; ++ } ++ ++ error_msg("Error: %s", desc_item); ++ json_object_put(error); ++ free(desc_item); ++ } ++ ++ json_object_put(errors_array); ++ return; ++} ++ + static GHashTable *bodhi_parse_json(json_object *json, const char *release) + { + +@@ -326,7 +378,7 @@ static GHashTable *bodhi_query_list(const char *query, const char *release) + get(post_state, bodhi_url_bugs, "application/x-www-form-urlencoded", + headers); + +- if (post_state->http_resp_code != 200) ++ if (post_state->http_resp_code != 200 && post_state->http_resp_code != 400) + { + char *errmsg = post_state->curl_error_msg; + if (errmsg && errmsg[0]) +@@ -340,6 +392,22 @@ static GHashTable *bodhi_query_list(const char *query, const char *release) + if (is_error(json)) + error_msg_and_die("fatal: unable parse response from bodhi server"); + ++ /* we must check the http_resp_code because only error responses contain ++ * 'status' item. 'bodhi_read_value' function prints an error message in ++ * the case it did not found the item */ ++ if (post_state->http_resp_code != 200) ++ { ++ char *status_item = NULL; ++ bodhi_read_value(json, "status", &status_item, BODHI_READ_STR); ++ if (status_item != NULL && strcmp(status_item, "error") == 0) ++ { ++ free(status_item); ++ bodhi_print_errors_from_json(json); ++ json_object_put(json); ++ xfunc_die(); // error_msg are printed in bodhi_print_errors_from_json ++ } ++ } ++ + GHashTable *bodhi_table = bodhi_parse_json(json, release); + json_object_put(json); + free_post_state(post_state); +-- +2.5.0 + diff --git a/abrt.spec b/abrt.spec index baeae6a..5b85436 100644 --- a/abrt.spec +++ b/abrt.spec @@ -43,13 +43,13 @@ %define docdirversion -%{version} %endif -%define libreport_ver 2.6.2 +%define libreport_ver 2.6.2-4 %define satyr_ver 0.19 Summary: Automatic bug detection and reporting tool Name: abrt Version: 2.6.2 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ Group: Applications/System URL: https://abrt.readthedocs.org/ @@ -86,6 +86,17 @@ Patch0023: 0023-ccpp-use-global-TID.patch #Patch0025: 0025-testsutie-first-wait_for_hooks-then-get_crash_path.patch #Patch0026: 0026-testsuite-make-ccpp-plugin-hook-unwind-more-robust.patch Patch0027: 0027-correct-usage-of-abrt-gdb-exploitable.patch +Patch0028: 0028-a-a-s-p-d-add-bash-on-the-package-blacklist.patch +Patch0029: 0029-cli-don-t-start-reporting-of-not-reportable-problems.patch +#Patch0030: 0030-testsuite-cli-sanity-not-reportable-problems-are-not.patch +#Patch0031: 0031-testsuite-useless-var_log_messages-files-are-not-cre.patch +Patch0032: 0032-convert-all-ex.message-stmts-to-str-ex.patch +Patch0033: 0033-introduce-bodhi2-to-abrt-bodhi.patch +#Patch0034: 0034-spec-add-hawkey-to-BRs-of-abrt-bodhi.patch +Patch0035: 0035-ccpp-do-not-break-the-reporting-if-a-bodhi-fails.patch +Patch0036: 0036-bodhi-add-ignoring-of-Rawhide.patch +Patch0037: 0037-bodhi-add-parsing-of-error-responses.patch +#Patch0038: 0038-testsuite-d-e-handling-set-PrivateReports-to-no-in-a.patch # '%%autosetup -S git' -> git BuildRequires: git @@ -291,6 +302,7 @@ BuildRequires: json-c-devel Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} BuildRequires: libreport-web-devel >= %{libreport_ver} +BuildRequires: hawkey-devel Obsoletes: libreport-plugin-bodhi > 0.0.1 Provides: libreport-plugin-bodhi @@ -1073,6 +1085,17 @@ killall abrt-dbus >/dev/null 2>&1 || : %config(noreplace) %{_sysconfdir}/profile.d/abrt-console-notification.sh %changelog +* Wed Aug 26 2015 Matej Habrnal 2.6.2-7 +- bodhi: add parsing of error responses +- bodhi: add ignoring of Rawhide +- do not break the reporting if a-bodhi fails +- spec: add hawkey to BRs of abrt-bodhi +- introduce bodhi2 to abrt-bodhi +- convert all 'ex.message' stmts to 'str(ex)' +- don't start reporting of not-reportable problems +- add bash on the package blacklist +- Resolves #1250379 + * Fri Aug 14 2015 Matej Habrnal 2.6.2-6 - ccpp - use global TID - fix comment related to 'MakeCompatCore' option in CCpp.conf