No substantial code changes. Please review.
diff -x '*.po' -d -urpN abrt.3/lib/Plugins/Bugzilla.cpp abrt.4/lib/Plugins/Bugzilla.cpp --- abrt.3/lib/Plugins/Bugzilla.cpp 2010-03-17 13:01:15.000000000 +0100 +++ abrt.4/lib/Plugins/Bugzilla.cpp 2010-03-17 15:48:43.092151654 +0100 @@ -106,7 +106,7 @@ struct ctx: public abrt_xmlrpc_conn { const char* get_bug_resolution(xmlrpc_value* result_xml); const char* get_bug_reporter(xmlrpc_value* result_xml);
- xmlrpc_value* call_quicksearch_uuid(const char* component, const char* uuid); + xmlrpc_value* call_quicksearch_duphash(const char* component, const char* duphash); xmlrpc_value* get_cc_member(xmlrpc_value* result_xml); xmlrpc_value* get_member(const char* member, xmlrpc_value* result_xml);
@@ -298,9 +298,9 @@ void ctx::get_bug_cc(xmlrpc_value* resul return; }
-xmlrpc_value* ctx::call_quicksearch_uuid(const char* component, const char* uuid) +xmlrpc_value* ctx::call_quicksearch_duphash(const char* component, const char* duphash) { - std::string query = ssprintf("ALL component:"%s" statuswhiteboard:"%s"", component, uuid); + std::string query = ssprintf("ALL component:"%s" statuswhiteboard:"%s"", component, duphash); return call("Bug.search", "({s:s})", "quicksearch", query.c_str()); }
@@ -350,7 +350,7 @@ xmlrpc_int32 ctx::new_bug(const map_cras const std::string& component = get_crash_data_item_content(pCrashData, FILENAME_COMPONENT); const std::string& release = get_crash_data_item_content(pCrashData, FILENAME_RELEASE); const std::string& arch = get_crash_data_item_content(pCrashData, FILENAME_ARCHITECTURE); - const std::string& uuid = get_crash_data_item_content(pCrashData, CD_DUPHASH); + const std::string& duphash = get_crash_data_item_content(pCrashData, CD_DUPHASH); const char *reason = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_REASON);
std::string summary = "[abrt] crash in " + package; @@ -359,7 +359,7 @@ xmlrpc_int32 ctx::new_bug(const map_cras summary += ": "; summary += reason; } - std::string status_whiteboard = "abrt_hash:" + uuid; + std::string status_whiteboard = "abrt_hash:" + duphash;
std::string description = "abrt "VERSION" detected a crash.\n\n"; description += make_description_bz(pCrashData); @@ -455,7 +455,7 @@ int ctx::get_bug_info(struct bug_info* b // mandatory when bug status is CLOSED and resolution is DUPLICATE if ((strcmp(bz->bug_status, "CLOSED") == 0) && (strcmp(bz->bug_resolution, "DUPLICATE") == 0) - ) { + ) { bz->bug_dup_id = get_bug_dup_id(result); if (env.fault_occurred) return -1; @@ -554,14 +554,14 @@ std::string CReporterBugzilla::Report(co }
const std::string& component = get_crash_data_item_content(pCrashData, FILENAME_COMPONENT); - const std::string& uuid = get_crash_data_item_content(pCrashData, CD_DUPHASH); + const std::string& duphash = get_crash_data_item_content(pCrashData, CD_DUPHASH);
ctx bz_server(BugzillaXMLRPC.c_str(), NoSSLVerify);
bz_server.login(Login.c_str(), Password.c_str());
update_client(_("Checking for duplicates...")); - xmlrpc_value* result = bz_server.call_quicksearch_uuid(component.c_str(), uuid.c_str()); + xmlrpc_value* result = bz_server.call_quicksearch_duphash(component.c_str(), duphash.c_str()); if (!result) { throw_if_xml_fault_occurred(&bz_server.env); @@ -577,7 +577,7 @@ std::string CReporterBugzilla::Report(co }
int all_bugs_size = bz_server.get_array_size(all_bugs); - if (all_bugs_size == -1) + if (all_bugs_size < 0) { throw_if_xml_fault_occurred(&bz_server.env); } @@ -599,17 +599,19 @@ std::string CReporterBugzilla::Report(co update_client(_("Logging out...")); bz_server.logout();
- std::string bug_status = "Status: NEW\n"; - BugzillaURL = bug_status + BugzillaURL; - BugzillaURL += "/show_bug.cgi?id="; - BugzillaURL += to_string(bug_id); - return BugzillaURL; + std::string bug_status = ssprintf( + "Status: NEW\n" + "%s/show_bug.cgi?id=%u", + BugzillaURL.c_str(), + (int)bug_id + ); + return bug_status; } - else if (all_bugs_size > 1) + else /* all_bugs_size >= 1 */ { - // When someone clones bug it has same uuid, so we can find more than 1. + // When someone clones bug it has same duphash, so we can find more than 1. // Need to be checked if component is same. - VERB3 log("Bugzilla has %i same uuids(%s)", all_bugs_size, uuid.c_str()); + VERB3 log("Bugzilla has %u reports with same duphash '%s'", all_bugs_size, duphash.c_str()); }
// decision based on state @@ -682,15 +684,15 @@ std::string CReporterBugzilla::Report(co std::string description = make_description_reproduce_comment(pCrashData); if (!description.empty()) { - const char* package = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_PACKAGE); - const char* release = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_RELEASE); - const char* arch = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_ARCHITECTURE); + const char* package = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_PACKAGE); + const char* release = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_RELEASE); + const char* arch = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_ARCHITECTURE);
- description = ssprintf( "Package: %s\n" - "Architecture: %s\n" - "OS Release: %s\n" - "%s", package, arch, release, description.c_str() - ); + description = ssprintf("Package: %s\n" + "Architecture: %s\n" + "OS Release: %s\n" + "%s", package, arch, release, description.c_str() + );
update_client(_("Add new comment into bug(%d)"), (int)bug_id); if (bz_server.add_comment(bug_id, description.c_str()) == -1) @@ -704,25 +706,19 @@ std::string CReporterBugzilla::Report(co update_client(_("Logging out...")); bz_server.logout();
- std::string bug_status; - - std::string status = bz.bug_status; - if (bz.bug_resolution) - { - std::string resolution = bz.bug_resolution; - bug_status = "Status: " + status + " " + resolution + "\n"; - } - else - { - bug_status = "Status: " + status + "\n"; - } + std::string bug_status = ssprintf( + "Status: %s%s%s\n" + "%s/show_bug.cgi?id=%u", + bz.bug_status, + bz.bug_resolution ? " " : "", + bz.bug_resolution ? bz.bug_resolution : "", + BugzillaURL.c_str(), + (int)bug_id + );
bug_info_destroy(&bz);
- BugzillaURL = bug_status + BugzillaURL; - BugzillaURL += "/show_bug.cgi?id="; - BugzillaURL += to_string(bug_id); - return BugzillaURL; + return bug_status; }
//todo: make static
On 03/17/2010 04:10 PM, Denys Vlasenko wrote:
On Wed, 2010-03-17 at 15:57 +0100, Denys Vlasenko wrote:
- else if (all_bugs_size> 1)
- else /* all_bugs_size>= 1 */
This part is obviously wrong...
I don't see anything else, so you can commit when you fix this one.
Reviewed by: jmoskovc@redhat.com
On Wed, 2010-03-17 at 21:40 +0100, Jiri Moskovcak wrote:
On 03/17/2010 04:10 PM, Denys Vlasenko wrote:
On Wed, 2010-03-17 at 15:57 +0100, Denys Vlasenko wrote:
- else if (all_bugs_size> 1)
- else /* all_bugs_size>= 1 */
This part is obviously wrong...
I don't see anything else, so you can commit when you fix this one.
Done, thanks for review.
crash-catcher@lists.fedorahosted.org