diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CommLayer/CommLayerInner.h | 132 | ||||
-rw-r--r-- | lib/CommLayer/Makefile.am | 6 | ||||
-rw-r--r-- | lib/CommLayer/Observer.h | 1 | ||||
-rw-r--r-- | lib/MiddleWare/Makefile.am | 4 | ||||
-rw-r--r-- | lib/MiddleWare/PluginManager.cpp | 36 | ||||
-rw-r--r-- | lib/Plugins/Bugzilla.cpp | 9 | ||||
-rw-r--r-- | lib/Plugins/CCpp.cpp | 12 | ||||
-rw-r--r-- | lib/Plugins/Kerneloops.cpp | 9 | ||||
-rw-r--r-- | lib/Plugins/KerneloopsReporter.cpp | 4 | ||||
-rw-r--r-- | lib/Plugins/Logger.cpp | 3 | ||||
-rw-r--r-- | lib/Plugins/Mailx.cpp | 5 | ||||
-rw-r--r-- | lib/Plugins/Makefile.am | 14 | ||||
-rw-r--r-- | lib/Plugins/RunApp.cpp | 3 | ||||
-rw-r--r-- | lib/Utils/DebugDump.cpp | 16 | ||||
-rw-r--r-- | lib/Utils/Makefile.am | 1 |
15 files changed, 165 insertions, 90 deletions
diff --git a/lib/CommLayer/CommLayerInner.h b/lib/CommLayer/CommLayerInner.h index 7edd257..70e1c30 100644 --- a/lib/CommLayer/CommLayerInner.h +++ b/lib/CommLayer/CommLayerInner.h @@ -4,62 +4,102 @@ #include <iostream> #include "Observer.h" -namespace CommLayerInner +class CDebugCommLayer { - - class CDebug - { - private: - CObserver *m_pObs; - public: - CDebug(CObserver *pObs) : - m_pObs(pObs) - {} - void Message(const std::string& pMsg) + private: + CObserver *m_pObserver; + public: + CDebugCommLayer(CObserver *pObs) : + m_pObserver(pObs) + {} + void Message(const std::string& pMsg) + { + if(m_pObserver) { - if(m_pObs) - m_pObs->Debug(pMsg); + m_pObserver->Debug(pMsg); } - }; + } +}; - class CWarning - { - private: - CObserver *m_pObs; - public: - CWarning(CObserver *pObs) : - m_pObs(pObs) - {} - void Message(const std::string& pMsg) +class CWarningCommLayer +{ + private: + CObserver *m_pObserver; + public: + CWarningCommLayer(CObserver *pObs) : + m_pObserver(pObs) + {} + void Message(const std::string& pMsg) + { + if(m_pObserver) { - if(m_pObs) - m_pObs->Warning(pMsg); + m_pObserver->Warning(pMsg); } - }; + } +}; - class CStatus - { - private: - CObserver *m_pObs; - public: - CStatus(CObserver *pObs) : - m_pObs(pObs) - {} - void Message(const std::string& pMsg) +class CStatusCommLayer +{ + private: + CObserver *m_pObserver; + public: + CStatusCommLayer(CObserver *pObs) : + m_pObserver(pObs) + {} + void Message(const std::string& pMsg) + { + if(m_pObserver) { - if(m_pObs) - m_pObs->Status(pMsg); + m_pObserver->Status(pMsg); } - }; - - - void init_debug(CObserver* pObserver); - void init_warning(CObserver* pObserver); - void init_status(CObserver* pObserver); + } +}; - void debug(const std::string& pMessage); - void warning(const std::string& pMessage); - void status(const std::string& pMessage); +class CCommLayerInner +{ + private: + CDebugCommLayer* m_pDebugCommLayer; + CWarningCommLayer* m_pWarningCommLayer; + CStatusCommLayer* m_pStatusCommLayer; + public: + CDebugCommLayer* GetDebugCommLayer() + { + return m_pDebugCommLayer; + } + CWarningCommLayer* GetWarningCommLayer() + { + return m_pWarningCommLayer; + } + CStatusCommLayer* GetStatusCommLayer() + { + return m_pStatusCommLayer; + } + CCommLayerInner(CObserver *pObs, const bool& pDebug, const bool pWarning) + { + m_pDebugCommLayer = NULL; + m_pWarningCommLayer = NULL; + if (pDebug) + { + m_pDebugCommLayer = new CDebugCommLayer(pObs); + } + if (pWarning) + { + m_pWarningCommLayer = new CWarningCommLayer(pObs); + } + m_pStatusCommLayer = new CStatusCommLayer(pObs); + } + ~CCommLayerInner() + { + if (m_pDebugCommLayer) + { + delete m_pDebugCommLayer; + } + if (m_pWarningCommLayer) + { + delete m_pWarningCommLayer; + } + delete m_pStatusCommLayer; + } }; #endif /* COMMLAYERINNER_H_ */ diff --git a/lib/CommLayer/Makefile.am b/lib/CommLayer/Makefile.am index d17cdc8..c9cd748 100644 --- a/lib/CommLayer/Makefile.am +++ b/lib/CommLayer/Makefile.am @@ -3,12 +3,12 @@ libABRTCommLayer_la_SOURCES = CommLayerServer.h CommLayerServer.cpp \ CommLayerServerSocket.h CommLayerServerSocket.cpp \ CommLayerServerDBus.h CommLayerServerDBus.cpp \ DBusServerProxy.h Observer.h DBusCommon.h \ - CommLayerInner.h CommLayerInner.cpp + CommLayerInner.h libABRTCommLayer_la_LIBADD = ../../lib/MiddleWare/libABRTMiddleWare.la $(DL_LIBS) $(DBUSCPP_LIBS) libABRTCommLayer_la_LDFLAGS = -version-info 0:1:0 -libABRTCommLayer_la_CPPFLAGS = -Wall -Werror -I../../lib/MiddleWare\ - -I../../lib/DBus \ +libABRTCommLayer_la_CPPFLAGS = -Wall -Werror -I$(srcdir)/../../lib/MiddleWare\ + -I$(srcdir)/../../lib/DBus -I$(srcdir)/../../inc\ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" $(GLIB_CFLAGS) $(DBUSCPP_CFLAGS) \ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ diff --git a/lib/CommLayer/Observer.h b/lib/CommLayer/Observer.h index a26b7b7..d691bca 100644 --- a/lib/CommLayer/Observer.h +++ b/lib/CommLayer/Observer.h @@ -2,6 +2,7 @@ #define OBSERVER_H_ #include "CrashTypes.h" +#include <string> class CObserver { public: diff --git a/lib/MiddleWare/Makefile.am b/lib/MiddleWare/Makefile.am index c6aa8cf..d29b913 100644 --- a/lib/MiddleWare/Makefile.am +++ b/lib/MiddleWare/Makefile.am @@ -3,12 +3,12 @@ libABRTMiddleWare_la_SOURCES = MiddleWare.cpp MiddleWare.h PluginManager.cpp \ PluginManager.h ABRTPlugin.cpp \ ABRTPlugin.h DynamicLibrary.cpp \ DynamicLibrary.h \ - RPM.cpp RPM.h Plugin.h CrashTypes.h \ + RPM.cpp RPM.h Plugin.h \ MiddleWareTypes.h Action.h Database.h \ Reporter.h Analyzer.h libABRTMiddleWare_la_LIBADD = $(DL_LIBS) ../Utils/libABRTUtils.la $(RPM_LIBS) libABRTMiddleWare_la_LDFLAGS = -version-info 0:1:0 -libABRTMiddleWare_la_CPPFLAGS = -I$(srcdir)/../Utils -I$(srcdir)/../CommLayer $(RPM_CFLAGS) +libABRTMiddleWare_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../Utils $(RPM_CFLAGS) check_PROGRAMS = test test_SOURCES = test.cpp diff --git a/lib/MiddleWare/PluginManager.cpp b/lib/MiddleWare/PluginManager.cpp index f3d89e5..8b01f47 100644 --- a/lib/MiddleWare/PluginManager.cpp +++ b/lib/MiddleWare/PluginManager.cpp @@ -22,7 +22,7 @@ #include <iostream> #include "PluginManager.h" #include "ABRTException.h" -#include "CommLayer.h" +#include "ABRTCommLayer.h" #include <dirent.h> #include <stdio.h> #include <sys/types.h> @@ -84,7 +84,7 @@ void CPluginManager::LoadPlugin(const std::string& pName) { throw CABRTException(EXCEP_PLUGIN, "CPluginManager::LoadPlugin(): non-compatible plugin"); } - CommLayerInner::debug("Plugin " + pName + " (" + abrtPlugin->GetVersion() + ") succesfully loaded."); + ABRTCommLayer::debug("Plugin " + pName + " (" + abrtPlugin->GetVersion() + ") succesfully loaded."); m_mapABRTPlugins[pName] = abrtPlugin; } catch (CABRTException& e) @@ -93,8 +93,8 @@ void CPluginManager::LoadPlugin(const std::string& pName) { delete abrtPlugin; } - CommLayerInner::debug("CPluginManager::LoadPlugin(): " + e.what()); - CommLayerInner::debug("Failed to load plugin " + pName); + ABRTCommLayer::warning("CPluginManager::LoadPlugin(): " + e.what()); + ABRTCommLayer::warning("Failed to load plugin " + pName); } } } @@ -106,7 +106,7 @@ void CPluginManager::UnLoadPlugin(const std::string& pName) UnRegisterPlugin(pName); delete m_mapABRTPlugins[pName]; m_mapABRTPlugins.erase(pName); - CommLayerInner::debug("Plugin " + pName + " sucessfully unloaded."); + ABRTCommLayer::debug("Plugin " + pName + " sucessfully unloaded."); } } @@ -126,14 +126,14 @@ void CPluginManager::RegisterPlugin(const std::string& pName) } catch (std::string sError) { - CommLayerInner::debug("Can not initialize plugin " + pName + "(" - + std::string(plugin_type_str_t[m_mapABRTPlugins[pName]->GetType()]) - + ")"); + ABRTCommLayer::warning("Can not initialize plugin " + pName + "(" + + std::string(plugin_type_str_t[m_mapABRTPlugins[pName]->GetType()]) + + ")"); UnLoadPlugin(pName); return; } m_mapPlugins[pName] = plugin; - CommLayerInner::debug("Registred plugin " + pName + "(" + ABRTCommLayer::debug("Registred plugin " + pName + "(" + std::string(plugin_type_str_t[m_mapABRTPlugins[pName]->GetType()]) + ")"); } @@ -149,7 +149,7 @@ void CPluginManager::UnRegisterPlugin(const std::string& pName) m_mapPlugins[pName]->DeInit(); delete m_mapPlugins[pName]; m_mapPlugins.erase(pName); - CommLayerInner::debug("UnRegistred plugin " + pName + "(" + ABRTCommLayer::debug("UnRegistred plugin " + pName + "(" + std::string(plugin_type_str_t[m_mapABRTPlugins[pName]->GetType()]) + ")"); } @@ -160,8 +160,8 @@ CAnalyzer* CPluginManager::GetAnalyzer(const std::string& pName) { if (m_mapPlugins.find(pName) == m_mapPlugins.end()) { - throw std::string("CPluginManager::GetAnalyzer():" - "Analyzer plugin: '"+pName+"' is not loaded."); + throw CABRTException(EXCEP_PLUGIN, "CPluginManager::GetAnalyzer():" + "Analyzer plugin: '"+pName+"' is not loaded."); } return dynamic_cast<CAnalyzer*>(m_mapPlugins[pName]); } @@ -170,8 +170,8 @@ CReporter* CPluginManager::GetReporter(const std::string& pName) { if (m_mapPlugins.find(pName) == m_mapPlugins.end()) { - throw std::string("CPluginManager::GetReporter():" - "Reporter plugin: '"+pName+"' is not loaded."); + throw CABRTException(EXCEP_PLUGIN, "CPluginManager::GetReporter():" + "Reporter plugin: '"+pName+"' is not loaded."); } return dynamic_cast<CReporter*>(m_mapPlugins[pName]); } @@ -180,8 +180,8 @@ CAction* CPluginManager::GetAction(const std::string& pName) { if (m_mapPlugins.find(pName) == m_mapPlugins.end()) { - throw std::string("CPluginManager::GetAction():" - "Action plugin: '"+pName+"' is not loaded."); + throw CABRTException(EXCEP_PLUGIN, "CPluginManager::GetAction():" + "Action plugin: '"+pName+"' is not loaded."); } return dynamic_cast<CAction*>(m_mapPlugins[pName]); } @@ -190,8 +190,8 @@ CDatabase* CPluginManager::GetDatabase(const std::string& pName) { if (m_mapPlugins.find(pName) == m_mapPlugins.end()) { - throw std::string("CPluginManager::GetDatabase():" - "Database plugin: '"+pName+"' is not loaded."); + throw CABRTException(EXCEP_PLUGIN, "CPluginManager::GetDatabase():" + "Database plugin: '"+pName+"' is not loaded."); } return dynamic_cast<CDatabase*>(m_mapPlugins[pName]); } diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp index ed9e02c..7a56966 100644 --- a/lib/Plugins/Bugzilla.cpp +++ b/lib/Plugins/Bugzilla.cpp @@ -4,6 +4,7 @@ #include "PluginSettings.h" #include "DebugDump.h" #include "ABRTException.h" +#include "ABRTCommLayer.h" #include <iostream> CReporterBugzilla::CReporterBugzilla() : @@ -34,7 +35,7 @@ void CReporterBugzilla::Login() { rpc->call(m_pXmlrpcClient, m_pCarriageParm); ret = xmlrpc_c::value_struct(rpc->getResult()); - std::cerr << "Login id: " << xmlrpc_c::value_int(ret["id"]) << std::endl; + ABRTCommLayer::debug("Login id: " + xmlrpc_c::value_int(ret["id"])); } catch (std::exception& e) { @@ -155,7 +156,7 @@ void CReporterBugzilla::NewBug(const map_crash_report_t& pCrashReport) { rpc->call(m_pXmlrpcClient, m_pCarriageParm); ret = xmlrpc_c::value_struct(rpc->getResult()); - std::cerr << "New bug id: " << xmlrpc_c::value_int(ret["id"]) << std::endl; + ABRTCommLayer::debug("New bug id: " + xmlrpc_c::value_int(ret["id"])); } catch (std::exception& e) { @@ -169,11 +170,15 @@ void CReporterBugzilla::Report(const map_crash_report_t& pCrashReport, const std std::string package = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT]; std::string component = package.substr(0, package.rfind("-", package.rfind("-")-1)); std::string uuid = pCrashReport.find(CD_UUID)->second[CD_CONTENT]; + ABRTCommLayer::status("Logging into bugzilla..."); Login(); + ABRTCommLayer::status("Checking for duplicates..."); if (!CheckUUIDInBugzilla(component, uuid)) { + ABRTCommLayer::status("Creating new bug..."); NewBug(pCrashReport); } + ABRTCommLayer::status("Logging out..."); Logout(); } diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 7aacc2f..da52d0b 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -23,7 +23,7 @@ #include "ABRTException.h" #include "DebugDump.h" #include "PluginSettings.h" -#include "CommLayer.h" +#include "ABRTCommLayer.h" #include <fstream> #include <sstream> #include <iostream> @@ -89,7 +89,7 @@ std::string CAnalyzerCCpp::CreateHash(const std::string& pInput) void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage) { - CommLayerInner::status("Installing debug infos..."); + ABRTCommLayer::status("Installing debug infos..."); std::string packageName = pPackage.substr(0, pPackage.rfind("-", pPackage.rfind("-")-1)); char buff[1024]; @@ -195,7 +195,7 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage) void CAnalyzerCCpp::GetBacktrace(const std::string& pDebugDumpDir, std::string& pBacktrace) { - CommLayerInner::status("Getting backtrace..."); + ABRTCommLayer::status("Getting backtrace..."); std::string tmpFile = "/tmp/" + pDebugDumpDir.substr(pDebugDumpDir.rfind("/")); std::ofstream fTmp; @@ -422,7 +422,7 @@ void CAnalyzerCCpp::ExecVP(const char* pCommand, char* const pArgs[], const std: std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir) { - CommLayerInner::status("Getting global universal unique identification..."); + ABRTCommLayer::status("Getting local universal unique identification..."); CDebugDump dd; std::string UID; @@ -446,7 +446,7 @@ std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir) } std::string CAnalyzerCCpp::GetGlobalUUID(const std::string& pDebugDumpDir) { - CommLayerInner::status("Getting local universal unique identification..."); + ABRTCommLayer::status("Getting global universal unique identification..."); std::string backtrace; std::string executable; @@ -464,7 +464,7 @@ std::string CAnalyzerCCpp::GetGlobalUUID(const std::string& pDebugDumpDir) void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir) { - CommLayerInner::status("Starting report creation..."); + ABRTCommLayer::status("Starting report creation..."); std::string package; std::string backtrace; diff --git a/lib/Plugins/Kerneloops.cpp b/lib/Plugins/Kerneloops.cpp index 179ba41..3b8fce6 100644 --- a/lib/Plugins/Kerneloops.cpp +++ b/lib/Plugins/Kerneloops.cpp @@ -29,6 +29,7 @@ #include "DebugDump.h" #include "PluginSettings.h" #include "ABRTException.h" +#include "ABRTCommLayer.h" #include <sstream> #include <assert.h> @@ -58,6 +59,8 @@ void CAnalyzerKerneloops::WriteSysLog(int m_nCount) std::string CAnalyzerKerneloops::GetLocalUUID(const std::string& pDebugDumpDir) { + ABRTCommLayer::status("Getting local/global universal unique identification..."); + std::string m_sOops; std::stringstream m_sHash; CDebugDump m_pDebugDump; @@ -85,6 +88,8 @@ std::string CAnalyzerKerneloops::GetGlobalUUID(const std::string& pDebugDumpDir) void CAnalyzerKerneloops::Report() { + ABRTCommLayer::status("Creating crash reports..."); + CDebugDump m_pDebugDump; char m_sPath[PATH_MAX]; std::list<COops> m_pOopsList; @@ -157,6 +162,8 @@ void CAnalyzerKerneloops::Init() void CAnalyzerKerneloops::ScanDmesg() { + ABRTCommLayer::debug("Scanning dmesg..."); + int m_nFoundOopses; char *buffer; @@ -172,6 +179,8 @@ void CAnalyzerKerneloops::ScanDmesg() void CAnalyzerKerneloops::ScanSysLogFile(const char *filename, int issyslog) { + ABRTCommLayer::debug("Scanning syslog..."); + char *buffer; struct stat statb; FILE *file; diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp index 15af3ac..cbefe0e 100644 --- a/lib/Plugins/KerneloopsReporter.cpp +++ b/lib/Plugins/KerneloopsReporter.cpp @@ -25,8 +25,8 @@ */ #include "KerneloopsReporter.h" -#include "DebugDump.h" #include "PluginSettings.h" +#include "ABRTCommLayer.h" #include <stdlib.h> #include <string.h> @@ -59,6 +59,8 @@ size_t writefunction(void *ptr, size_t size, size_t nmemb, void __attribute((unu void CKerneloopsReporter::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs) { + ABRTCommLayer::status("Creating and submitting a report..."); + CURL *handle; struct curl_httppost *post = NULL; struct curl_httppost *last = NULL; diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp index 43c219f..9d972e3 100644 --- a/lib/Plugins/Logger.cpp +++ b/lib/Plugins/Logger.cpp @@ -24,6 +24,7 @@ #include "PluginSettings.h" #include <sstream> #include "DebugDump.h" +#include "ABRTCommLayer.h" CLogger::CLogger() : m_sLogPath("/var/log/abrt-logger"), @@ -47,6 +48,8 @@ void CLogger::LoadSettings(const std::string& pPath) void CLogger::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs) { + ABRTCommLayer::status("Creating a report..."); + std::stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile; std::ofstream fOut; diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp index 6a5cb59..069e013 100644 --- a/lib/Plugins/Mailx.cpp +++ b/lib/Plugins/Mailx.cpp @@ -25,6 +25,7 @@ #include "DebugDump.h" #include "ABRTException.h" #include "PluginSettings.h" +#include "ABRTCommLayer.h" #define MAILX_COMMAND "/bin/mailx" @@ -40,6 +41,8 @@ CMailx::CMailx() : void CMailx::SendEmail(const std::string& pSubject, const std::string& pText) { + ABRTCommLayer::status("Sending an email..."); + FILE* command; std::string mailx_command = MAILX_COMMAND + m_sAttachments + " " + m_sParameters + @@ -61,6 +64,8 @@ void CMailx::SendEmail(const std::string& pSubject, const std::string& pText) void CMailx::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs) { + ABRTCommLayer::status("Creating a report..."); + std::stringstream emailBody; std::stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile; diff --git a/lib/Plugins/Makefile.am b/lib/Plugins/Makefile.am index 3b91de2..3e4aec6 100644 --- a/lib/Plugins/Makefile.am +++ b/lib/Plugins/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils +AM_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils pluginslibdir=$(PLUGINS_LIB_DIR) pluginslib_LTLIBRARIES = libCCpp.la \ libMailx.la \ @@ -17,18 +17,18 @@ dist_pluginsconf_DATA = CCpp.conf Mailx.conf SQLite3.conf Logger.conf Kerneloops libCCpp_la_SOURCES = CCpp.cpp CCpp.h PluginSettings.h libCCpp_la_LDFLAGS = -avoid-version libCCpp_la_LIBADD = $(NSS_LIBS) -libCCpp_la_CPPFLAGS = -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -I$(srcdir)/../CommLayer -DCCPP_HOOK_PATH=\"${libexecdir}/hookCCpp\" -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" $(NSS_CFLAGS) +libCCpp_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -DCCPP_HOOK_PATH=\"${libexecdir}/hookCCpp\" -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" $(NSS_CFLAGS) # Kerneloops libKerneloops_la_SOURCES = Kerneloops.cpp Kerneloops.h KerneloopsSysLog.cpp KerneloopsSysLog.h PluginSettings.h libKerneloops_la_LDFLAGS = -avoid-version -libKerneloops_la_CPPFLAGS = -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" -DCCPP_HOOK_PATH=\"${libexecdir}/hookKerneloopsoops\" +libKerneloops_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" -DCCPP_HOOK_PATH=\"${libexecdir}/hookKerneloopsoops\" # KerneloopsReporter libKerneloopsReporter_la_SOURCES = KerneloopsReporter.cpp KerneloopsReporter.h PluginSettings.h libKerneloopsReporter_la_LDFLAGS = -avoid-version libKerneloopsReporter_la_LIBADD = $(CURL_LIBS) -libKerneloopsReporter_la_CPPFLAGS = -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils $(CURL_CFLAGS) +libKerneloopsReporter_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare $(CURL_CFLAGS) # Mailx libMailx_la_SOURCES = Mailx.cpp Mailx.h PluginSettings.h @@ -38,7 +38,7 @@ libMailx_la_LDFLAGS = -avoid-version libSQLite3_la_SOURCES = SQLite3.cpp SQLite3.h PluginSettings.h libSQLite3_la_LDFLAGS = -avoid-version libSQLite3_la_LIBADD = $(SQLITE3_LIBS) -libSQLite3_la_CPPFLAGS = -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils $(SQLITE3_CFLAGS) +libSQLite3_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils $(SQLITE3_CFLAGS) # Logger libLogger_la_SOURCES = Logger.cpp Logger.h PluginSettings.h @@ -52,11 +52,11 @@ libRunApp_la_LDFLAGS = -avoid-version libBugzilla_la_SOURCES = Bugzilla.h Bugzilla.cpp libBugzilla_la_LIBADD = $(XMLRPC_CPP_LIBS) $(XMLRPC_CLIENT_CPP_LIBS) libBugzilla_la_LDFLAGS = -avoid-version -libBugzilla_la_CPPFLAGS = $(XMLRPC_CPP_CFLAGS) $(XMLRPC_CLIENT_CPP_CFLAGS) -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils +libBugzilla_la_CPPFLAGS = $(XMLRPC_CPP_CFLAGS) $(XMLRPC_CLIENT_CPP_CFLAGS) -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils # Python libPython_la_SOURCES = Python.h Python.cpp #libPython_la_LIBADD = $(NSS_LIBS) libPython_la_LDFLAGS = -avoid-version -libPython_la_CPPFLAGS = $(NSS_CFLAGS) -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils +libPython_la_CPPFLAGS = $(NSS_CFLAGS) -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils diff --git a/lib/Plugins/RunApp.cpp b/lib/Plugins/RunApp.cpp index 8a8db08..5a20283 100644 --- a/lib/Plugins/RunApp.cpp +++ b/lib/Plugins/RunApp.cpp @@ -24,6 +24,7 @@ #include <stdio.h> #include "DebugDump.h" #include "ABRTException.h" +#include "ABRTCommLayer.h" #define COMMAND 0 #define FILENAME 1 @@ -58,6 +59,8 @@ void CActionRunApp::ParseArgs(const std::string& psArgs, vector_args_t& pArgs) void CActionRunApp::Run(const std::string& pDebugDumpDir, const std::string& pArgs) { + ABRTCommLayer::status("Executing RunApp plugin..."); + char line[1024]; std::string output = ""; diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp index 8dd3114..421deb6 100644 --- a/lib/Utils/DebugDump.cpp +++ b/lib/Utils/DebugDump.cpp @@ -100,12 +100,14 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string& getline(fIn, line); if (line == pPID) { + fIn.close(); m_bUnlock = false; return true; } ss << "/proc/" << line << "/"; if (!ExistFileDir(ss.str())) { + fIn.close(); remove(pLockFile.c_str()); Delete(); throw CABRTException(EXCEP_ERROR, "CDebugDump::GetAndSetLock(): dead lock found"); @@ -117,17 +119,21 @@ bool CDebugDump::GetAndSetLock(const std::string& pLockFile, const std::string& void CDebugDump::Lock() { - std::string lockPath = m_sDebugDumpDir + ".lock"; + int ii = 0; + std::string lockFile = m_sDebugDumpDir + ".lock"; pid_t nPID = getpid(); std::stringstream ss; ss << nPID; - std::cerr << "CDebugDump::Lock(): waiting..."; - while (!GetAndSetLock(lockPath, ss.str())) + while (!GetAndSetLock(lockFile, ss.str())) { - std::cerr << "."; usleep(5000); + // 40000 is about 20s, that should be enough. + if (ii > 40000) + { + throw CABRTException(EXCEP_DD_OPEN, "CDebugDump::Lock(): timeout occurs when opening '"+m_sDebugDumpDir+"'"); + } + ii++; } - std::cerr << "done." << std::endl; } void CDebugDump::UnLock() diff --git a/lib/Utils/Makefile.am b/lib/Utils/Makefile.am index a5c35f3..c873920 100644 --- a/lib/Utils/Makefile.am +++ b/lib/Utils/Makefile.am @@ -2,6 +2,7 @@ lib_LTLIBRARIES = libABRTUtils.la libABRTUtils_la_SOURCES = DebugDump.cpp DebugDump.h libABRTUtils_la_LDFLAGS = -version-info 0:1:0 libABRTUtils_la_LIBADD = -lmagic +libABRTUtils_la_CPPFLAGS = -I$(srcdir)/../../inc install-data-local: $(mkdir_p) '$(DESTDIR)/$(DEBUG_DUMPS_DIR)'
\ No newline at end of file |