diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-09 12:57:59 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-09 12:57:59 +0200 |
commit | b0d2f3c7f257be07bbf8af8e963335127ef43d65 (patch) | |
tree | ae488263112c9a81cda06066a447c7bf03180dc1 | |
parent | 6cc5b01813ba87e4a68ed848f91a6a3d573af0f6 (diff) | |
download | abrt-b0d2f3c7f257be07bbf8af8e963335127ef43d65.tar.gz abrt-b0d2f3c7f257be07bbf8af8e963335127ef43d65.tar.xz abrt-b0d2f3c7f257be07bbf8af8e963335127ef43d65.zip |
*: add "force" param to CreateReport dbus call. If !0, regenerates backtrace
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | lib/Plugins/CCpp.cpp | 17 | ||||
-rw-r--r-- | lib/Plugins/CCpp.h | 2 | ||||
-rw-r--r-- | lib/Plugins/FileTransfer.cpp | 2 | ||||
-rw-r--r-- | lib/Plugins/Kerneloops.h | 2 | ||||
-rw-r--r-- | lib/Plugins/Python.h | 2 | ||||
-rw-r--r-- | lib/Utils/Analyzer.h | 2 | ||||
-rw-r--r-- | src/Daemon/CommLayerServerDBus.cpp | 11 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.cpp | 10 | ||||
-rw-r--r-- | src/Daemon/CrashWatcher.h | 4 | ||||
-rw-r--r-- | src/Daemon/Daemon.cpp | 6 | ||||
-rw-r--r-- | src/Daemon/MiddleWare.cpp | 14 | ||||
-rw-r--r-- | src/Daemon/MiddleWare.h | 1 | ||||
-rw-r--r-- | src/Gui/CCDBusBackend.py | 3 |
13 files changed, 45 insertions, 31 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index c054c781..a2665ed4 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -578,7 +578,7 @@ static bool DebuginfoCheckPolkit(int uid) } -void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir) +void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir, int force) { update_client(_("Starting report creation...")); @@ -588,18 +588,19 @@ void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir) CDebugDump dd; dd.Open(pDebugDumpDir); - bool bt_exists = dd.Exist(FILENAME_BACKTRACE); - if (bt_exists) + if (!force) { - dd.Close(); /* do not keep dir locked longer than needed */ - return; /* already done */ + bool bt_exists = dd.Exist(FILENAME_BACKTRACE); + if (bt_exists) + { + return; /* backtrace already exists */ + } } dd.LoadText(FILENAME_PACKAGE, package); dd.LoadText(FILENAME_UID, UID); - dd.Close(); - + dd.Close(); /* do not keep dir locked longer than needed */ map_plugin_settings_t settings = GetSettings(); if (settings["InstallDebuginfo"] == "yes" && @@ -609,7 +610,7 @@ void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir) } else { - warn_client(_("Skipping debuginfo installation")); + VERB1 log(_("Skipping debuginfo installation")); } GetBacktrace(pDebugDumpDir, backtrace); diff --git a/lib/Plugins/CCpp.h b/lib/Plugins/CCpp.h index 92b6bab7..3fbe0b9e 100644 --- a/lib/Plugins/CCpp.h +++ b/lib/Plugins/CCpp.h @@ -38,7 +38,7 @@ class CAnalyzerCCpp : public CAnalyzer CAnalyzerCCpp(); virtual std::string GetLocalUUID(const std::string& pDebugDumpDir); virtual std::string GetGlobalUUID(const std::string& pDebugDumpDir); - virtual void CreateReport(const std::string& pDebugDumpDir); + virtual void CreateReport(const std::string& pDebugDumpDir, int force); virtual void Init(); virtual void DeInit(); virtual void SetSettings(const map_plugin_settings_t& pSettings); diff --git a/lib/Plugins/FileTransfer.cpp b/lib/Plugins/FileTransfer.cpp index 287eb399..3492156f 100644 --- a/lib/Plugins/FileTransfer.cpp +++ b/lib/Plugins/FileTransfer.cpp @@ -197,7 +197,7 @@ static void create_tar(const char * archive_name, const char * directory) { return; } - tar_append_tree(tar, (char *)directory, "."); + tar_append_tree(tar, (char *)directory, (char*)"."); tar_close(tar); } diff --git a/lib/Plugins/Kerneloops.h b/lib/Plugins/Kerneloops.h index 1be58fc6..13fb0098 100644 --- a/lib/Plugins/Kerneloops.h +++ b/lib/Plugins/Kerneloops.h @@ -39,7 +39,7 @@ class CAnalyzerKerneloops : public CAnalyzer public: virtual std::string GetLocalUUID(const std::string& pDebugDumpDir); virtual std::string GetGlobalUUID(const std::string& pDebugDumpDir); - virtual void CreateReport(const std::string& pDebugDumpDir) {} + virtual void CreateReport(const std::string& pDebugDumpDir, int force) {} }; #endif diff --git a/lib/Plugins/Python.h b/lib/Plugins/Python.h index 57eefbf9..b54de8dc 100644 --- a/lib/Plugins/Python.h +++ b/lib/Plugins/Python.h @@ -10,7 +10,7 @@ class CAnalyzerPython : public CAnalyzer public: virtual std::string GetLocalUUID(const std::string& pDebugDumpDir); virtual std::string GetGlobalUUID(const std::string& pDebugDumpDir); - virtual void CreateReport(const std::string& pDebugDumpDir) {} + virtual void CreateReport(const std::string& pDebugDumpDir, int force) {} virtual void Init(); virtual void DeInit(); virtual std::string CreateHash(const std::string& pInput); diff --git a/lib/Utils/Analyzer.h b/lib/Utils/Analyzer.h index 4fe586b8..e5bda574 100644 --- a/lib/Utils/Analyzer.h +++ b/lib/Utils/Analyzer.h @@ -50,7 +50,7 @@ class CAnalyzer : public CPlugin * somewhere afterwards. * @param pDebugDumpPath A debugdump dir containing all necessary data. */ - virtual void CreateReport(const std::string& pDebugDumpPath) = 0; + virtual void CreateReport(const std::string& pDebugDumpPath, int force) = 0; }; #endif /*ANALYZER_H_*/ diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index 1085d803..35d2944e 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -156,6 +156,13 @@ static int handle_CreateReport(DBusMessage* call, DBusMessage* reply) dbus_message_iter_init(call, &in_iter); const char* pUUID; r = load_val(&in_iter, pUUID); + if (r != ABRT_DBUS_MORE_FIELDS) + { + error_msg("dbus call %s: parameter type mismatch", __func__ + 7); + return -1; + } + int32_t force; + r = load_val(&in_iter, force); if (r != ABRT_DBUS_LAST_FIELD) { error_msg("dbus call %s: parameter type mismatch", __func__ + 7); @@ -164,7 +171,7 @@ static int handle_CreateReport(DBusMessage* call, DBusMessage* reply) const char* sender; long unix_uid = get_remote_uid(call, &sender); - if (CreateReportThread(pUUID, to_string(unix_uid).c_str(), sender) != 0) + if (CreateReportThread(pUUID, to_string(unix_uid).c_str(), force, sender) != 0) return -1; /* can't create thread (err msg is already logged) */ dbus_message_append_args(reply, @@ -189,7 +196,7 @@ static int handle_GetJobResult(DBusMessage* call, DBusMessage* reply) } long unix_uid = get_remote_uid(call); - map_crash_report_t report = GetJobResult(pUUID, to_string(unix_uid).c_str()); + map_crash_report_t report = GetJobResult(pUUID, to_string(unix_uid).c_str(), /*force:*/ 0); DBusMessageIter out_iter; dbus_message_iter_init_append(reply, &out_iter); diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 5cc9dc74..60936466 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -109,7 +109,7 @@ vector_crash_infos_t GetCrashInfos(const std::string &pUID) * CreateReport dbus call already did all the processing, and we just retrieve * the result from dump directory, which is fast. */ -map_crash_report_t GetJobResult(const char* pUUID, const char* pUID) +map_crash_report_t GetJobResult(const char* pUUID, const char* pUID, int force) { map_crash_info_t crashReport; @@ -118,7 +118,7 @@ map_crash_report_t GetJobResult(const char* pUUID, const char* pUID) * g_pPluginManager->GetDatabase(g_settings_sDatabase); * which is unsafe wrt concurrent updates to g_pPluginManager state. */ - mw_result_t res = CreateCrashReport(pUUID, pUID, crashReport); + mw_result_t res = CreateCrashReport(pUUID, pUID, force, crashReport); switch (res) { case MW_OK: @@ -144,6 +144,7 @@ typedef struct thread_data_t { pthread_t thread_id; char* UUID; char* UID; + int force; char* peer; } thread_data_t; static void* create_report(void* arg) @@ -159,7 +160,7 @@ static void* create_report(void* arg) { /* "GetJobResult" is a bit of a misnomer */ log("Creating report..."); - map_crash_info_t crashReport = GetJobResult(thread_data->UUID, thread_data->UID); + map_crash_info_t crashReport = GetJobResult(thread_data->UUID, thread_data->UID, thread_data->force); g_pCommLayer->JobDone(thread_data->peer, thread_data->UUID); } catch (CABRTException& e) @@ -187,11 +188,12 @@ static void* create_report(void* arg) /* Bogus value. pthreads require us to return void* */ return NULL; } -int CreateReportThread(const char* pUUID, const char* pUID, const char* pSender) +int CreateReportThread(const char* pUUID, const char* pUID, int force, const char* pSender) { thread_data_t *thread_data = (thread_data_t *)xzalloc(sizeof(thread_data_t)); thread_data->UUID = xstrdup(pUUID); thread_data->UID = xstrdup(pUID); + thread_data->force = force; thread_data->peer = xstrdup(pSender); //TODO: do we need this? //pthread_attr_t attr; diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index 00bb4d51..d8c7c28a 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -49,8 +49,8 @@ class CCrashWatcher }; vector_crash_infos_t GetCrashInfos(const std::string &pUID); -int CreateReportThread(const char* pUUID, const char* pUID, const char* pSender); -map_crash_report_t GetJobResult(const char* pUUID, const char* pUID); +int CreateReportThread(const char* pUUID, const char* pUID, int force, const char* pSender); +map_crash_report_t GetJobResult(const char* pUUID, const char* pUID, int force); bool DeleteDebugDump(const std::string& pUUID, const std::string& pUID); #endif /*CRASHWATCHER_H_*/ diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 3b66bdb9..05c5f0b0 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -50,7 +50,7 @@ * - GetCrashInfos(): returns a vector_crash_infos_t (vector_map_vector_string_t) * of crashes for given uid * v[N]["executable"/"uid"/"kernel"/"backtrace"][N] = "contents" - * - CreateReport(UUID): starts creating a report for /var/cache/abrt/DIR with this UUID. + * - CreateReport(UUID,force): starts creating a report for /var/cache/abrt/DIR with this UUID. * Returns job id (uint64). * Emits JobStarted(client_dbus_ID,job_id) dbus signal. * After it returns, when report creation thread has finished, @@ -82,7 +82,7 @@ * * TODO: * - API does not really need JobStarted dbus signal at all, and JobDone signal - * does not need to pass any parameters - out clients never sent multiple + * does not need to pass any parameters - out clients never send multiple * CreateReport's. */ @@ -153,7 +153,7 @@ static double GetDirSize(const std::string &pPath, std::string *worst_dir = NULL if (worst_dir && strcmp(excluded, ep->d_name) != 0) { /* Calculate "weighted" size and age - /* w = sz_kbytes * age_mins */ + * w = sz_kbytes * age_mins */ sz /= 1024; long age = (time(NULL) - stats.st_mtime) / 60; if (age > 0) diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index b05dbb6a..05abc9b5 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -163,15 +163,17 @@ static std::string GetGlobalUUID(const std::string& pAnalyzer, * @param pDebugDumpPath A debugdump dir containing all necessary data. */ static void CreateReport(const std::string& pAnalyzer, - const std::string& pDebugDumpDir) + const std::string& pDebugDumpDir, + int force) { CAnalyzer* analyzer = g_pPluginManager->GetAnalyzer(pAnalyzer); - analyzer->CreateReport(pDebugDumpDir); + analyzer->CreateReport(pDebugDumpDir, force); } mw_result_t CreateCrashReport(const std::string& pUUID, - const std::string& pUID, - map_crash_report_t& pCrashReport) + const std::string& pUID, + int force, + map_crash_report_t& pCrashReport) { VERB2 log("CreateCrashReport('%s','%s',result)", pUUID.c_str(), pUID.c_str()); @@ -185,7 +187,7 @@ mw_result_t CreateCrashReport(const std::string& pUUID, } if (pUUID == "" || row.m_sUUID != pUUID) { - warn_client("CreateCrashReport(): UUID '"+pUUID+"' is not in database."); + warn_client("CreateCrashReport(): UUID '"+pUUID+"' is not in database"); return MW_IN_DB_ERROR; } @@ -211,7 +213,7 @@ mw_result_t CreateCrashReport(const std::string& pUUID, dd.Close(); VERB3 log(" CreateReport('%s')", analyzer.c_str()); - CreateReport(analyzer, row.m_sDebugDumpDir); + CreateReport(analyzer, row.m_sDebugDumpDir, force); gUUID = GetGlobalUUID(analyzer, row.m_sDebugDumpDir); VERB3 log(" GetGlobalUUID:'%s'", gUUID.c_str()); diff --git a/src/Daemon/MiddleWare.h b/src/Daemon/MiddleWare.h index bc80952a..fab822fe 100644 --- a/src/Daemon/MiddleWare.h +++ b/src/Daemon/MiddleWare.h @@ -65,6 +65,7 @@ void LoadOpenGPGPublicKey(const char* key); */ mw_result_t CreateCrashReport(const std::string& pUUID, const std::string& pUID, + int force, map_crash_report_t& pCrashReport); /** * Activates particular action plugin. diff --git a/src/Gui/CCDBusBackend.py b/src/Gui/CCDBusBackend.py index dfb405e3..70db9fff 100644 --- a/src/Gui/CCDBusBackend.py +++ b/src/Gui/CCDBusBackend.py @@ -158,7 +158,8 @@ class DBusManager(gobject.GObject): self.emit("report-done", result) def getReport(self, UUID): - self.daemon().CreateReport(UUID, timeout=60) + # 2nd param is "force recreating of backtrace etc" + self.daemon().CreateReport(UUID, 0, timeout=60) def Report(self, report, reporters_settings = None): # map < Plguin_name vec <status, message> > |