diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-20 16:42:17 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-20 16:42:17 +0100 |
commit | 562cb414ee83452749058c2c976019c663111e55 (patch) | |
tree | 4dc3fb3bd887155494925f487a4737618c27c213 | |
parent | f4beeadc35e646a9ad17e66c5afa2137fd4ff137 (diff) | |
download | abrt-562cb414ee83452749058c2c976019c663111e55.tar.gz abrt-562cb414ee83452749058c2c976019c663111e55.tar.xz abrt-562cb414ee83452749058c2c976019c663111e55.zip |
split load_crash_data_from_debug_dump from DebugDumpToCrashReport
We will need it elsewhere later
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | lib/Plugins/Bugzilla.cpp | 14 | ||||
-rw-r--r-- | lib/Plugins/KerneloopsScanner.cpp | 2 | ||||
-rw-r--r-- | lib/Plugins/Python.cpp | 2 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerDBus.cpp | 7 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.cpp | 3 | ||||
-rw-r--r-- | src/Daemon/Daemon.cpp | 6 | ||||
-rw-r--r-- | src/Daemon/MiddleWare.cpp | 53 |
7 files changed, 47 insertions, 40 deletions
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp index 8a5a797..aafa019 100644 --- a/lib/Plugins/Bugzilla.cpp +++ b/lib/Plugins/Bugzilla.cpp @@ -442,12 +442,12 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData, update_client(_("Checking for duplicates...")); bug_id = bz_server.check_uuid_in_bugzilla(component.c_str(), uuid.c_str()); - update_client(_("Logging into bugzilla...")); if ((Login == "") && (Password == "")) { VERB3 log("Empty login and password"); throw CABRTException(EXCEP_PLUGIN, _("Empty login and password. Please check Bugzilla.conf")); } + update_client(_("Logging into bugzilla...")); bz_server.login(Login.c_str(), Password.c_str()); if (bug_id > 0) @@ -458,7 +458,9 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData, bz_server.add_plus_one_cc(bug_id, Login.c_str()); } bz_server.logout(); - return BugzillaURL + "/show_bug.cgi?id=" + to_string(bug_id); + BugzillaURL += "/show_bug.cgi?id="; + BugzillaURL += to_string(bug_id); + return BugzillaURL; } update_client(_("Creating new bug...")); @@ -475,12 +477,16 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData, if (bug_id > 0) { - return BugzillaURL + "/show_bug.cgi?id=" + to_string(bug_id); + BugzillaURL += "/show_bug.cgi?id="; + BugzillaURL += to_string(bug_id); + return BugzillaURL; } - return BugzillaURL + "/show_bug.cgi?id="; + BugzillaURL += "/show_bug.cgi?id="; + return BugzillaURL; } +//todo: make static map_plugin_settings_t CReporterBugzilla::parse_settings(const map_plugin_settings_t& pSettings) { map_plugin_settings_t plugin_settings; diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp index 47043c2..42ffd40 100644 --- a/lib/Plugins/KerneloopsScanner.cpp +++ b/lib/Plugins/KerneloopsScanner.cpp @@ -34,8 +34,6 @@ #include "KerneloopsSysLog.h" #include "KerneloopsScanner.h" -#include <limits.h> - // TODO: https://fedorahosted.org/abrt/ticket/78 CKerneloopsScanner::CKerneloopsScanner() diff --git a/lib/Plugins/Python.cpp b/lib/Plugins/Python.cpp index 79247d6..ad95468 100644 --- a/lib/Plugins/Python.cpp +++ b/lib/Plugins/Python.cpp @@ -5,9 +5,9 @@ static std::string CreateHash(const char *pDebugDumpDir) { - std::string uuid; CDebugDump dd; dd.Open(pDebugDumpDir); + std::string uuid; dd.LoadText(FILENAME_UUID, uuid); return uuid; } diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index fef8c57..ddfbba4 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -249,15 +249,14 @@ static int handle_Report(DBusMessage* call, DBusMessage* reply) } } +#if 0 //const char * sender = dbus_message_get_sender(call); if (!user_conf_data.empty()) { - std::string PluginName; map_map_string_t::const_iterator it_user_conf_data = user_conf_data.begin(); for (; it_user_conf_data != user_conf_data.end(); it_user_conf_data++) { - PluginName = it_user_conf_data->first; -#if DEBUG + std::string PluginName = it_user_conf_data->first; std::cout << "plugin name: " << it_user_conf_data->first; map_string_t::const_iterator it_plugin_config; for (it_plugin_config = it_user_conf_data->second.begin(); @@ -266,11 +265,11 @@ static int handle_Report(DBusMessage* call, DBusMessage* reply) { std::cout << " key: " << it_plugin_config->first << " value: " << it_plugin_config->second << std::endl; } -#endif // this would overwrite the default settings //g_pPluginManager->SetPluginSettings(PluginName, sender, plugin_settings); } } +#endif long unix_uid = get_remote_uid(call); report_status_t argout1; diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 8a1aacd..80d8cd4 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -98,13 +98,12 @@ vector_map_crash_data_t GetCrashInfos(const char *pUID) */ map_crash_data_t CreateReport(const char* pUUID, const char* pUID, int force) { - map_crash_data_t crashReport; - /* FIXME: starting from here, any shared data must be protected with a mutex. * For example, CreateCrashReport does: * g_pPluginManager->GetDatabase(g_settings_sDatabase.c_str()); * which is unsafe wrt concurrent updates to g_pPluginManager state. */ + map_crash_data_t crashReport; mw_result_t res = CreateCrashReport(pUUID, pUID, force, crashReport); switch (res) { diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 2964d58..c7acffc 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -320,9 +320,9 @@ static void FindNewDumps(const char* pPath) vector_string_t::iterator itt = dirs.begin(); for (; itt != dirs.end(); ++itt) { - map_crash_data_t crashinfo; try { + map_crash_data_t crashinfo; mw_result_t res = SaveDebugDump(itt->c_str(), crashinfo); switch (res) { @@ -476,11 +476,11 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin worst_dir = ""; } - map_crash_data_t crashinfo; try { std::string fullname = concat_path_file(DEBUG_DUMPS_DIR, name); - + map_crash_data_t crashinfo; +//todo: rename SaveDebugDump to ???? it does not save crashinfo, it FETCHES crashinfo mw_result_t res = SaveDebugDump(fullname.c_str(), crashinfo); switch (res) { diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index 4f24ee1..a2b20e6 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -120,29 +120,11 @@ static char* is_text_file(const char *name, ssize_t *sz) return NULL; /* it's binary */ } -/** - * Transforms a debugdump direcortry to inner crash - * report form. This form is used for later reporting. - * @param pDebugDumpDir A debugdump dir containing all necessary data. - * @param pCrashData A created crash report. - */ -static void DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& pCrashData) +static void load_crash_data_from_debug_dump(CDebugDump& dd, map_crash_data_t& data) { - CDebugDump dd; - dd.Open(pDebugDumpDir); - if (!dd.Exist(FILENAME_ARCHITECTURE) - || !dd.Exist(FILENAME_KERNEL) - || !dd.Exist(FILENAME_PACKAGE) - || !dd.Exist(FILENAME_COMPONENT) - || !dd.Exist(FILENAME_RELEASE) - || !dd.Exist(FILENAME_EXECUTABLE) - ) { - throw CABRTException(EXCEP_ERROR, "DebugDumpToCrashReport(): One or more of important file(s) are missing"); - } - std::string short_name; std::string full_name; - pCrashData.clear(); + dd.InitGetNextFile(); while (dd.GetNextFile(&short_name, &full_name)) { @@ -150,7 +132,7 @@ static void DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& char *text = is_text_file(full_name.c_str(), &sz); if (!text) { - add_to_crash_data_ext(pCrashData, + add_to_crash_data_ext(data, short_name.c_str(), CD_BIN, CD_ISNOTEDITABLE, @@ -173,7 +155,7 @@ static void DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& || short_name == FILENAME_RELEASE || short_name == FILENAME_EXECUTABLE ) { - add_to_crash_data_ext(pCrashData, + add_to_crash_data_ext(data, short_name.c_str(), CD_TXT, CD_ISNOTEDITABLE, @@ -190,7 +172,7 @@ static void DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& && short_name != FILENAME_COMMENT ) { add_to_crash_data_ext( - pCrashData, + data, short_name.c_str(), CD_TXT, CD_ISEDITABLE, @@ -201,6 +183,29 @@ static void DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& } /** + * Transforms a debugdump directory to inner crash + * report form. This form is used for later reporting. + * @param pDebugDumpDir A debugdump dir containing all necessary data. + * @param pCrashData A created crash report. + */ +static void DebugDumpToCrashReport(const char *pDebugDumpDir, map_crash_data_t& pCrashData) +{ + CDebugDump dd; + dd.Open(pDebugDumpDir); + if (!dd.Exist(FILENAME_ARCHITECTURE) + || !dd.Exist(FILENAME_KERNEL) + || !dd.Exist(FILENAME_PACKAGE) + || !dd.Exist(FILENAME_COMPONENT) + || !dd.Exist(FILENAME_RELEASE) + || !dd.Exist(FILENAME_EXECUTABLE) + ) { + throw CABRTException(EXCEP_ERROR, "DebugDumpToCrashReport(): One or more of important file(s) are missing"); + } + + load_crash_data_from_debug_dump(dd, pCrashData); +} + +/** * Get a local UUID from particular analyzer plugin. * @param pAnalyzer A name of an analyzer plugin. * @param pDebugDumpDir A debugdump dir containing all necessary data. @@ -299,7 +304,7 @@ mw_result_t CreateCrashReport(const char *pUUID, std::string gUUID = GetGlobalUUID(analyzer.c_str(), row.m_sDebugDumpDir.c_str()); VERB3 log(" GetGlobalUUID:'%s'", gUUID.c_str()); - VERB3 log(" RunAnalyzerActions"); + VERB3 log(" RunAnalyzerActions('%s','%s')", analyzer.c_str(), row.m_sDebugDumpDir.c_str()); RunAnalyzerActions(analyzer.c_str(), row.m_sDebugDumpDir.c_str()); VERB3 log(" DebugDumpToCrashReport"); DebugDumpToCrashReport(row.m_sDebugDumpDir.c_str(), pCrashData); |