From a71786ab92bdc45f5eae09ffe9d2839e86f5be11 Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Thu, 9 Aug 2012 17:52:00 +0200 Subject: [LIBREPORT PATCH 14/16] trac#556: skip not provided bz bug description template fields Signed-off-by: Jakub Filak --- src/plugins/rhbz.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c index ea8c09d..3bdf139 100644 --- a/src/plugins/rhbz.c +++ b/src/plugins/rhbz.c @@ -659,29 +659,32 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data, } else { + /* Generating of a description according to the RH bugzilla default format: + * https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora + */ + struct strbuf *tmp_full_dsc = strbuf_new(); + const char *comment = problem_data_get_content_or_NULL(problem_data, FILENAME_COMMENT); + if (comment) + strbuf_append_strf(tmp_full_dsc, "Description of problem:\n%s\n\n", comment); + + if (package) + strbuf_append_strf(tmp_full_dsc, "Version-Release number of selected component:\n%s\n\n", package); char *bz_dsc = make_description(problem_data, (char**)g_additional_info_files, - CD_TEXT_ATT_SIZE_BZ, MAKEDESC_SHOW_MULTILINE | MAKEDESC_WHITELIST); + CD_TEXT_ATT_SIZE_BZ, MAKEDESC_SHOW_MULTILINE | MAKEDESC_WHITELIST); + strbuf_append_strf(tmp_full_dsc, "Additional info:\nlibreport version: "VERSION"\n%s\n", bz_dsc); + free(bz_dsc); char *backtrace = rhbz_get_backtrace_info(problem_data, CD_TEXT_ATT_SIZE_BZ); + if (backtrace) + { + strbuf_append_str(tmp_full_dsc, backtrace); + free(backtrace); + } - /* Generating of a description according to the RH bugzilla default format: - * https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora - */ - full_dsc = xasprintf("Description of problem:\n%s\n\n" - "Version-Release number of selected component:\n%s\n\n" - "Additional info:\n" - "libreport version: "VERSION"\n%s\n" - "%s", - comment ? comment : "", - package, - bz_dsc, - backtrace ? backtrace : ""); - - free(backtrace); - free(bz_dsc); + full_dsc = strbuf_free_nobuf(tmp_full_dsc); } char *product = NULL; -- 1.7.11.2