|
|
0c9110 |
From 9a03b1ede8320c7cd82a1093f620ebcf4c3efb3d Mon Sep 17 00:00:00 2001
|
|
|
0c9110 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
0c9110 |
Date: Fri, 26 Sep 2014 19:56:28 +0200
|
|
|
0c9110 |
Subject: [LIBREPORT PATCH 88/93] bugzilla: add comment to closed bugs too
|
|
|
0c9110 |
|
|
|
0c9110 |
Resolves rhbz#1056101
|
|
|
0c9110 |
|
|
|
0c9110 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
0c9110 |
---
|
|
|
0c9110 |
src/plugins/reporter-bugzilla.c | 103 ++++++++++++++++++++++++----------------
|
|
|
0c9110 |
1 file changed, 62 insertions(+), 41 deletions(-)
|
|
|
0c9110 |
|
|
|
0c9110 |
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
|
|
|
0c9110 |
index 45aa2cc..097924e 100644
|
|
|
0c9110 |
--- a/src/plugins/reporter-bugzilla.c
|
|
|
0c9110 |
+++ b/src/plugins/reporter-bugzilla.c
|
|
|
0c9110 |
@@ -1266,54 +1266,75 @@ int main(int argc, char **argv)
|
|
|
0c9110 |
}
|
|
|
0c9110 |
}
|
|
|
0c9110 |
|
|
|
0c9110 |
- if (strcmp(bz->bi_status, "CLOSED") != 0)
|
|
|
0c9110 |
+ /* We used to skip adding the comment to CLOSED bugs:
|
|
|
0c9110 |
+ *
|
|
|
0c9110 |
+ * if (strcmp(bz->bi_status, "CLOSED") != 0)
|
|
|
0c9110 |
+ * {
|
|
|
0c9110 |
+ *
|
|
|
0c9110 |
+ * But that condition has been added without a good explanation of the
|
|
|
0c9110 |
+ * reason for doing so:
|
|
|
0c9110 |
+ *
|
|
|
0c9110 |
+ * ABRT commit 1bf37ad93e87f065347fdb7224578d55cca8d384
|
|
|
0c9110 |
+ *
|
|
|
0c9110 |
+ * - if (bug_id > 0)
|
|
|
0c9110 |
+ * + if (strcmp(bz.bug_status, "CLOSED") != 0)
|
|
|
0c9110 |
+ *
|
|
|
0c9110 |
+ *
|
|
|
0c9110 |
+ * From my point of view, there is no good reason to not add the comment to
|
|
|
0c9110 |
+ * such a bug. The reporter spent several minutes waiting for the backtrace
|
|
|
0c9110 |
+ * and we don't want to make the reporters feel that they spent their time
|
|
|
0c9110 |
+ * in vain and I think that adding comments to already closed bugs doesn't
|
|
|
0c9110 |
+ * hurt the maintainers (at least not me).
|
|
|
0c9110 |
+ *
|
|
|
0c9110 |
+ * Plenty of new comments might convince the maintainer to reconsider the
|
|
|
0c9110 |
+ * bug's status.
|
|
|
0c9110 |
+ */
|
|
|
0c9110 |
+
|
|
|
0c9110 |
+ /* Add user's login to CC if not there already */
|
|
|
0c9110 |
+ if (strcmp(bz->bi_reporter, rhbz.b_login) != 0
|
|
|
0c9110 |
+ && !g_list_find_custom(bz->bi_cc_list, rhbz.b_login, (GCompareFunc)g_strcmp0)
|
|
|
0c9110 |
+ ) {
|
|
|
0c9110 |
+ log(_("Adding %s to CC list"), rhbz.b_login);
|
|
|
0c9110 |
+ rhbz_mail_to_cc(client, bz->bi_id, rhbz.b_login, RHBZ_NOMAIL_NOTIFY);
|
|
|
0c9110 |
+ }
|
|
|
0c9110 |
+
|
|
|
0c9110 |
+ /* Add comment and bt */
|
|
|
0c9110 |
+ const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT);
|
|
|
0c9110 |
+ if (comment && comment[0])
|
|
|
0c9110 |
{
|
|
|
0c9110 |
- /* Add user's login to CC if not there already */
|
|
|
0c9110 |
- if (strcmp(bz->bi_reporter, rhbz.b_login) != 0
|
|
|
0c9110 |
- && !g_list_find_custom(bz->bi_cc_list, rhbz.b_login, (GCompareFunc)g_strcmp0)
|
|
|
0c9110 |
- ) {
|
|
|
0c9110 |
- log(_("Adding %s to CC list"), rhbz.b_login);
|
|
|
0c9110 |
- rhbz_mail_to_cc(client, bz->bi_id, rhbz.b_login, RHBZ_NOMAIL_NOTIFY);
|
|
|
0c9110 |
- }
|
|
|
0c9110 |
+ GList *comment_fmt_spec = load_bzrep_conf_file(fmt_file2);
|
|
|
0c9110 |
+ struct strbuf *bzcomment_buf = strbuf_new();
|
|
|
0c9110 |
+ generate_bz_comment(bzcomment_buf, problem_data, comment_fmt_spec);
|
|
|
0c9110 |
+ char *bzcomment = strbuf_free_nobuf(bzcomment_buf);
|
|
|
0c9110 |
+//TODO: free_comment_fmt_spec(comment_fmt_spec);
|
|
|
0c9110 |
|
|
|
0c9110 |
- /* Add comment and bt */
|
|
|
0c9110 |
- const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT);
|
|
|
0c9110 |
- if (comment && comment[0])
|
|
|
0c9110 |
+ int dup_comment = is_comment_dup(bz->bi_comments, bzcomment);
|
|
|
0c9110 |
+ if (!dup_comment)
|
|
|
0c9110 |
{
|
|
|
0c9110 |
- GList *comment_fmt_spec = load_bzrep_conf_file(fmt_file2);
|
|
|
0c9110 |
- struct strbuf *bzcomment_buf = strbuf_new();
|
|
|
0c9110 |
- generate_bz_comment(bzcomment_buf, problem_data, comment_fmt_spec);
|
|
|
0c9110 |
- char *bzcomment = strbuf_free_nobuf(bzcomment_buf);
|
|
|
0c9110 |
-//TODO: free_comment_fmt_spec(comment_fmt_spec);
|
|
|
0c9110 |
+ log(_("Adding new comment to bug %d"), bz->bi_id);
|
|
|
0c9110 |
+ rhbz_add_comment(client, bz->bi_id, bzcomment, 0);
|
|
|
0c9110 |
+ free(bzcomment);
|
|
|
0c9110 |
|
|
|
0c9110 |
- int dup_comment = is_comment_dup(bz->bi_comments, bzcomment);
|
|
|
0c9110 |
- if (!dup_comment)
|
|
|
0c9110 |
- {
|
|
|
0c9110 |
- log(_("Adding new comment to bug %d"), bz->bi_id);
|
|
|
0c9110 |
- rhbz_add_comment(client, bz->bi_id, bzcomment, 0);
|
|
|
0c9110 |
- free(bzcomment);
|
|
|
0c9110 |
-
|
|
|
0c9110 |
- const char *bt = problem_data_get_content_or_NULL(problem_data, FILENAME_BACKTRACE);
|
|
|
0c9110 |
- unsigned rating = 0;
|
|
|
0c9110 |
- const char *rating_str = problem_data_get_content_or_NULL(problem_data, FILENAME_RATING);
|
|
|
0c9110 |
- /* python doesn't have rating file */
|
|
|
0c9110 |
- if (rating_str)
|
|
|
0c9110 |
- rating = xatou(rating_str);
|
|
|
0c9110 |
- if (bt && rating > bz->bi_best_bt_rating)
|
|
|
0c9110 |
- {
|
|
|
0c9110 |
- char bug_id_str[sizeof(int)*3 + 2];
|
|
|
0c9110 |
- sprintf(bug_id_str, "%i", bz->bi_id);
|
|
|
0c9110 |
- log(_("Attaching better backtrace"));
|
|
|
0c9110 |
- rhbz_attach_blob(client, bug_id_str, FILENAME_BACKTRACE, bt, strlen(bt),
|
|
|
0c9110 |
- RHBZ_NOMAIL_NOTIFY);
|
|
|
0c9110 |
- }
|
|
|
0c9110 |
- }
|
|
|
0c9110 |
- else
|
|
|
0c9110 |
+ const char *bt = problem_data_get_content_or_NULL(problem_data, FILENAME_BACKTRACE);
|
|
|
0c9110 |
+ unsigned rating = 0;
|
|
|
0c9110 |
+ const char *rating_str = problem_data_get_content_or_NULL(problem_data, FILENAME_RATING);
|
|
|
0c9110 |
+ /* python doesn't have rating file */
|
|
|
0c9110 |
+ if (rating_str)
|
|
|
0c9110 |
+ rating = xatou(rating_str);
|
|
|
0c9110 |
+ if (bt && rating > bz->bi_best_bt_rating)
|
|
|
0c9110 |
{
|
|
|
0c9110 |
- free(bzcomment);
|
|
|
0c9110 |
- log(_("Found the same comment in the bug history, not adding a new one"));
|
|
|
0c9110 |
+ char bug_id_str[sizeof(int)*3 + 2];
|
|
|
0c9110 |
+ sprintf(bug_id_str, "%i", bz->bi_id);
|
|
|
0c9110 |
+ log(_("Attaching better backtrace"));
|
|
|
0c9110 |
+ rhbz_attach_blob(client, bug_id_str, FILENAME_BACKTRACE, bt, strlen(bt),
|
|
|
0c9110 |
+ RHBZ_NOMAIL_NOTIFY);
|
|
|
0c9110 |
}
|
|
|
0c9110 |
}
|
|
|
0c9110 |
+ else
|
|
|
0c9110 |
+ {
|
|
|
0c9110 |
+ free(bzcomment);
|
|
|
0c9110 |
+ log(_("Found the same comment in the bug history, not adding a new one"));
|
|
|
0c9110 |
+ }
|
|
|
0c9110 |
}
|
|
|
0c9110 |
|
|
|
0c9110 |
log_out:
|
|
|
0c9110 |
--
|
|
|
0c9110 |
1.8.3.1
|
|
|
0c9110 |
|