[libreport/f16] rhbz#768647 - fix crash when bt_rating doesn't exist

Nikola Pajkovsky npajkovs at fedoraproject.org
Tue Dec 20 11:31:22 UTC 2011


commit 9e0d7233c1f3abece9c29949d6f7d525d32ad2ae
Author: Nikola Pajkovsky <npajkovs at redhat.com>
Date:   Tue Dec 20 12:22:25 2011 +0100

    rhbz#768647 - fix crash when bt_rating doesn't exist
    
    Signed-off-by: Nikola Pajkovsky <npajkovs at redhat.com>
    (cherry picked from commit afe97cbda0c0035a893b06ac952e27fbda374607)

 ...-python-doen-t-have-a-backtrace_rating-fi.patch |   56 ++++++++++++++++++
 ...e-architecture-to-the-comment-only-if-it-.patch |   62 ++++++++++++++++++++
 libreport.spec                                     |   10 +++-
 3 files changed, 127 insertions(+), 1 deletions(-)
---
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
new file mode 100644
index 0000000..46384ba
--- /dev/null
+++ b/0001-rhbz-768647-python-doen-t-have-a-backtrace_rating-fi.patch
@@ -0,0 +1,56 @@
+From e93f6cb75fe3ad7991deff0696538c93ee04cc7a Mon Sep 17 00:00:00 2001
+Message-Id: <e93f6cb75fe3ad7991deff0696538c93ee04cc7a.1324377641.git.npajkovs at redhat.com>
+From: Nikola Pajkovsky <npajkovs at redhat.com>
+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 <npajkovs at redhat.com>
+---
+ 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-add-the-architecture-to-the-comment-only-if-it-.patch b/0001-rhbz-add-the-architecture-to-the-comment-only-if-it-.patch
new file mode 100644
index 0000000..31c23c2
--- /dev/null
+++ b/0001-rhbz-add-the-architecture-to-the-comment-only-if-it-.patch
@@ -0,0 +1,62 @@
+From 93c1aeb02086cfe5dbf6f9201956a7ab5fc1f631 Mon Sep 17 00:00:00 2001
+Message-Id: <93c1aeb02086cfe5dbf6f9201956a7ab5fc1f631.1324378958.git.npajkovs at redhat.com>
+From: Jiri Moskovcak <jmoskovc at redhat.com>
+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/libreport.spec b/libreport.spec
index faa21e4..6335e43 100644
--- a/libreport.spec
+++ b/libreport.spec
@@ -5,7 +5,7 @@
 Summary: Generic library for reporting various problems
 Name: libreport
 Version: 2.0.8
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2+
 Group: System Environment/Libraries
 URL: https://fedorahosted.org/abrt/
@@ -19,6 +19,8 @@ Patch5: 0006-if-OSRelease-environ-is-empty-load-OSRelease-from-pr.patch
 Patch6: 0009-bodhi-sync-enum-with-parse_opt.patch
 Patch7: 0010-inicializing-rpm-more-then-once-leads-to-sigsegv-in-.patch
 Patch8: 0011-url-takes-escaped-string.patch
+Patch9: 0001-rhbz-add-the-architecture-to-the-comment-only-if-it-.patch
+Patch10: 0001-rhbz-768647-python-doen-t-have-a-backtrace_rating-fi.patch
 BuildRequires: dbus-devel
 BuildRequires: gtk2-devel
 BuildRequires: curl-devel
@@ -228,6 +230,8 @@ Plugin to report bugs into anonymous FTP site associated with ticketing system.
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
+%patch9 -p1
+%patch10 -p1
 
 %build
 autoconf
@@ -390,6 +394,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %config(noreplace) %{_sysconfdir}/libreport/events.d/uploader_event.conf
 
 %changelog
+* Tue Dec 20 2011 Nikola Pajkovsky <npajkovs at redhat.com> 2.0.8-4
+- 768647 - [abrt] libreport-plugin-bugzilla-2.0.8-3.fc16: libreport_xatou:
+           Process /usr/bin/reporter-bugzilla was killed by signal 11 (SIGSEGV)
+
 * Fri Dec 09 2011 Jiri Moskovcak <jmoskovc at redhat.com> 2.0.8-3
 - fixed few crashes in bodhi plugin
 


More information about the scm-commits mailing list