From d72a86106c038fb2b8eba22b64bf3e261c9bd6a0 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 28 Jan 2010 13:17:07 +0100 Subject: SOSreport: run it niced Signed-off-by: Denys Vlasenko --- lib/Plugins/SOSreport.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/Plugins') diff --git a/lib/Plugins/SOSreport.cpp b/lib/Plugins/SOSreport.cpp index 90611b5d..500f8581 100644 --- a/lib/Plugins/SOSreport.cpp +++ b/lib/Plugins/SOSreport.cpp @@ -79,12 +79,13 @@ void CActionSOSreport::Run(const char *pActionDir, const char *pArgs, int force) } } - static const char command_default[] = "sosreport --batch --no-progressbar --only=anaconda --only=bootloader" + static const char command_default[] = "nice sosreport --batch --no-progressbar" + " --only=anaconda --only=bootloader" " --only=devicemapper --only=filesys --only=hardware --only=kernel" " --only=libraries --only=memory --only=networking --only=nfsserver" " --only=pam --only=process --only=rpm -k rpm.rpmva=off --only=ssh" " --only=startup --only=yum 2>&1"; - static const char command_prefix[] = "sosreport --batch --no-progressbar"; + static const char command_prefix[] = "nice sosreport --batch --no-progressbar"; string command; vector_string_t args; -- cgit From 3ede050314fb29e18ab9b1d87ad20e304120b59c Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Thu, 28 Jan 2010 14:45:20 +0100 Subject: Save the core where it belongs if ulimit -c is > 0 --- lib/Plugins/CCpp.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Plugins') diff --git a/lib/Plugins/CCpp.conf b/lib/Plugins/CCpp.conf index 153efb95..30e1550c 100644 --- a/lib/Plugins/CCpp.conf +++ b/lib/Plugins/CCpp.conf @@ -3,7 +3,7 @@ Enabled = yes # If you also want to dump file named "core" # in crashed process' current dir, set to "yes" -MakeCompatCore = no +MakeCompatCore = yes # Generate backtrace Backtrace = yes -- cgit From ef0f59ef4bcfe0776f24def077cef74ccdc16293 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 28 Jan 2010 15:03:31 +0100 Subject: SOSreport: do not leave stray files in /tmp Signed-off-by: Denys Vlasenko --- lib/Plugins/SOSreport.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/Plugins') diff --git a/lib/Plugins/SOSreport.cpp b/lib/Plugins/SOSreport.cpp index 500f8581..bc71e236 100644 --- a/lib/Plugins/SOSreport.cpp +++ b/lib/Plugins/SOSreport.cpp @@ -109,14 +109,19 @@ void CActionSOSreport::Run(const char *pActionDir, const char *pArgs, int force) update_client(_("Done running sosreport")); VERB3 log("sosreport output:'%s'", output.c_str()); + // Parse: + // "Your sosreport has been generated and saved in: + // /tmp/sosreport-XXXX.tar.bz2" string sosreport_filename = ParseFilename(output); string sosreport_dd_filename = concat_path_file(pActionDir, "sosreport.tar.bz2"); CDebugDump dd; dd.Open(pActionDir); - //Not useful - //dd.SaveText("sosreportoutput", output); - if (copy_file(sosreport_filename.c_str(), sosreport_dd_filename.c_str(), 0644) < 0) + //Not useful: dd.SaveText("sosreportoutput", output); + off_t sz = copy_file(sosreport_filename.c_str(), sosreport_dd_filename.c_str(), 0644); + unlink(sosreport_filename.c_str()); // don't want to leave sosreport-XXXX.tar.bz2 in /tmp + unlink((sosreport_filename + ".md5").c_str()); // sosreport-XXXX.tar.bz2.md5 too + if (sz < 0) { dd.Close(); throw CABRTException(EXCEP_PLUGIN, -- cgit From 099f3cac8c2bf532a796468fb2950c4551c85960 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 28 Jan 2010 15:28:35 +0100 Subject: Bugzilla,Catcut: fix or remove incomprehensible comments; fix error msg Signed-off-by: Denys Vlasenko --- lib/Plugins/Bugzilla.cpp | 69 ++++++++++++++---------------------------------- lib/Plugins/Catcut.cpp | 44 +++++++++++------------------- 2 files changed, 35 insertions(+), 78 deletions(-) (limited to 'lib/Plugins') diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp index 0197a7bf..fa6b35e4 100644 --- a/lib/Plugins/Bugzilla.cpp +++ b/lib/Plugins/Bugzilla.cpp @@ -44,8 +44,7 @@ void ctx::login(const char* login, const char* passwd) xmlrpc_env_init(&env); xmlrpc_value* param = xmlrpc_build_value(&env, "({s:s,s:s})", "login", login, "password", passwd); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "User.login", param, &result); @@ -68,16 +67,13 @@ void ctx::logout() xmlrpc_env_init(&env); xmlrpc_value* param = xmlrpc_build_value(&env, "(s)", ""); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "User.logout", param, &result); xmlrpc_DECREF(param); - if (result) - xmlrpc_DECREF(result); - if (env.fault_occurred) - throw_xml_fault(&env); + xmlrpc_DECREF(result); + throw_if_xml_fault_occurred(&env); } bool ctx::check_cc_and_reporter(uint32_t bug_id, const char* login) @@ -85,17 +81,13 @@ bool ctx::check_cc_and_reporter(uint32_t bug_id, const char* login) xmlrpc_env env; xmlrpc_env_init(&env); - // fails only when you write query. when it's done it never fails. xmlrpc_value* param = xmlrpc_build_value(&env, "(s)", to_string(bug_id).c_str()); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); // failed to allocate memory xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "bugzilla.getBug", param, &result); - // we don't need anymore xml structure for calling xmlrpc query(calls only once) xmlrpc_DECREF(param); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_value* reporter_member = NULL; xmlrpc_struct_find_value(&env, result, "reporter", &reporter_member); @@ -129,7 +121,7 @@ bool ctx::check_cc_and_reporter(uint32_t bug_id, const char* login) { VERB3 log("Missing member 'reporter'"); xmlrpc_DECREF(result); - throw CABRTException(EXCEP_PLUGIN, _("Missing member 'bugs'")); + throw CABRTException(EXCEP_PLUGIN, _("Missing member 'reporter'")); } xmlrpc_value* cc_member = NULL; @@ -179,7 +171,7 @@ bool ctx::check_cc_and_reporter(uint32_t bug_id, const char* login) } else { - VERB3 log("Missing member 'bugs'"); + VERB3 log("Missing member 'cc'"); xmlrpc_DECREF(result); throw CABRTException(EXCEP_PLUGIN, _("Missing member 'cc'")); } @@ -193,19 +185,14 @@ void ctx::add_plus_one_cc(uint32_t bug_id, const char* login) xmlrpc_env env; xmlrpc_env_init(&env); - // fails only when you write query. when it's done it never fails. xmlrpc_value* param = xmlrpc_build_value(&env, "({s:i,s:{s:(s)}})", "ids", bug_id, "updates", "add_cc", login); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); // failed to allocate memory xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "Bug.update", param, &result); - // we don't need anymore xml structure for calling xmlrpc query(calls only once) xmlrpc_DECREF(param); - if (env.fault_occurred) - throw_xml_fault(&env); - xmlrpc_DECREF(result); + throw_if_xml_fault_occurred(&env); } int32_t ctx::check_uuid_in_bugzilla(const char* component, const char* UUID) @@ -215,17 +202,13 @@ int32_t ctx::check_uuid_in_bugzilla(const char* component, const char* UUID) std::string query = ssprintf("ALL component:\"%s\" statuswhiteboard:\"%s\"", component, UUID); - // fails only when you write query. when it's done it never fails. xmlrpc_value* param = xmlrpc_build_value(&env, "({s:s})", "quicksearch", query.c_str()); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); // failed to allocate memory xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "Bug.search", param, &result); - // we don't need anymore xml structure for calling xmlrpc query(calls only once) xmlrpc_DECREF(param); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); // on error result is NULL, no need to DECREF xmlrpc_value* bugs_member = NULL; xmlrpc_struct_find_value(&env, result, "bugs", &bugs_member); @@ -237,7 +220,7 @@ int32_t ctx::check_uuid_in_bugzilla(const char* component, const char* UUID) if (bugs_member) { - // when array size is equal 0 that means no bug reported + // when array size is 0 that means no bug reported uint32_t array_size = xmlrpc_array_size(&env, bugs_member); if (env.fault_occurred) { @@ -325,7 +308,6 @@ uint32_t ctx::new_bug(const map_crash_data_t& pCrashData) std::string version; parse_release(release.c_str(), product, version); - // fails only when you write query. when it's done it never fails. xmlrpc_value* param = xmlrpc_build_value(&env, "({s:s,s:s,s:s,s:s,s:s,s:s,s:s})", "product", product.c_str(), "component", component.c_str(), @@ -335,17 +317,14 @@ uint32_t ctx::new_bug(const map_crash_data_t& pCrashData) "status_whiteboard", status_whiteboard.c_str(), "platform", arch.c_str() ); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); // failed to allocate memory - xmlrpc_value* result; + xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "Bug.create", param, &result); - // we don't need anymore xml structure for calling xmlrpc query(calls only once) xmlrpc_DECREF(param); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); - xmlrpc_value* id; + xmlrpc_value* id = NULL; xmlrpc_struct_find_value(&env, result, "id", &id); if (env.fault_occurred) { @@ -377,8 +356,6 @@ void ctx::add_attachments(const char* bug_id_str, const map_crash_data_t& pCrash xmlrpc_env env; xmlrpc_env_init(&env); - xmlrpc_value* result = NULL; - map_crash_data_t::const_iterator it = pCrashData.begin(); for (; it != pCrashData.end(); it++) { @@ -390,7 +367,6 @@ void ctx::add_attachments(const char* bug_id_str, const map_crash_data_t& pCrash && (content.length() > CD_TEXT_ATT_SIZE || itemname == FILENAME_BACKTRACE) ) { char *encoded64 = encode_base64(content.c_str(), content.length()); - // fails only when you write query. when it's done it never fails. xmlrpc_value* param = xmlrpc_build_value(&env, "(s{s:s,s:s,s:s,s:s})", bug_id_str, "description", ("File: " + itemname).c_str(), @@ -399,18 +375,13 @@ void ctx::add_attachments(const char* bug_id_str, const map_crash_data_t& pCrash "data", encoded64 ); free(encoded64); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); // failed to allocate memory + xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "bugzilla.addAttachment", param, &result); - // we don't need anymore xml structure for calling xmlrpc query(calls only once) xmlrpc_DECREF(param); - if (env.fault_occurred) - { - xmlrpc_DECREF(result); - throw_xml_fault(&env); - } xmlrpc_DECREF(result); + throw_if_xml_fault_occurred(&env); } } } diff --git a/lib/Plugins/Catcut.cpp b/lib/Plugins/Catcut.cpp index 3580a3b4..badca4b4 100644 --- a/lib/Plugins/Catcut.cpp +++ b/lib/Plugins/Catcut.cpp @@ -167,14 +167,12 @@ struct_find_int(xmlrpc_env* env, xmlrpc_value* result, { xmlrpc_value* an_xmlrpc_value; xmlrpc_struct_find_value(env, result, fieldName, &an_xmlrpc_value); - if (env->fault_occurred) - throw_xml_fault(env); + throw_if_xml_fault_occurred(env); if (an_xmlrpc_value) { xmlrpc_read_int(env, an_xmlrpc_value, &value); - if (env->fault_occurred) - throw_xml_fault(env); + throw_if_xml_fault_occurred(env); xmlrpc_DECREF(an_xmlrpc_value); return true; } @@ -187,14 +185,12 @@ struct_find_string(xmlrpc_env* env, xmlrpc_value* result, { xmlrpc_value* an_xmlrpc_value; xmlrpc_struct_find_value(env, result, fieldName, &an_xmlrpc_value); - if (env->fault_occurred) - throw_xml_fault(env); + throw_if_xml_fault_occurred(env); if (an_xmlrpc_value) { const char* value_s; xmlrpc_read_string(env, an_xmlrpc_value, &value_s); - if (env->fault_occurred) - throw_xml_fault(env); + throw_if_xml_fault_occurred(env); value = value_s; xmlrpc_DECREF(an_xmlrpc_value); free((void*)value_s); @@ -233,24 +229,20 @@ ctx::login(const char* login, const char* passwd) xmlrpc_env_init(&env); xmlrpc_value* param = xmlrpc_build_value(&env, "(ss)", login, passwd); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); - xmlrpc_value* result; + xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "Catcut.auth", param, &result); xmlrpc_DECREF(param); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_value *cookie_xml; const char *cookie; string cookie_str; xmlrpc_struct_find_value(&env, result, "cookie", &cookie_xml); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_read_string(&env, cookie_xml, &cookie); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); cookie_str = cookie; /* xmlrpc_read_string returns *malloc'ed ptr*. * doc is not very clear on it, but I looked in xmlrpc sources. */ @@ -293,24 +285,20 @@ ctx::new_bug(const char *auth_cookie, const map_crash_data_t& pCrashData) "status_whiteboard", status_whiteboard.c_str(), "platform", arch.c_str() ); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_value *result; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "Catcut.createTicket", param, &result); xmlrpc_DECREF(param); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_value *bug_id_xml; const char *bug_id; string bug_id_str; xmlrpc_struct_find_value(&env, result, "ticket", &bug_id_xml); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_read_string(&env, bug_id_xml, &bug_id); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); bug_id_str = bug_id; log("New bug id: %s", bug_id); update_client(_("New bug id: %s"), bug_id); @@ -334,14 +322,12 @@ ctx::request_upload(const char* auth_cookie, const char* pTicketName, pTicketName, fileName, description); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); xmlrpc_value* result = NULL; xmlrpc_client_call2(&env, m_pClient, m_pServer_info, "Catcut.requestUpload", param, &result); xmlrpc_DECREF(param); - if (env.fault_occurred) - throw_xml_fault(&env); + throw_if_xml_fault_occurred(&env); string URL; bool has_URL = struct_find_string(&env, result, "uri", URL); -- cgit