summaryrefslogtreecommitdiffstats
path: root/src/Daemon
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2009-12-15 18:01:28 +0100
committerJiri Moskovcak <jmoskovc@redhat.com>2009-12-15 18:01:28 +0100
commitdd92fc9b28a88ba47560d923064f88e2e523c505 (patch)
tree5a690ddd2c1b72b9c6f9a5fba02e2fd2f40db7fe /src/Daemon
parent5d7dc59d8f83a167352ab8b1783d34d473918da3 (diff)
downloadabrt-dd92fc9b28a88ba47560d923064f88e2e523c505.tar.gz
abrt-dd92fc9b28a88ba47560d923064f88e2e523c505.tar.xz
abrt-dd92fc9b28a88ba47560d923064f88e2e523c505.zip
don't blame python for every crash in /usr/bin/python rhbz#533521 trac#109
- when there is a bug in 3rd party python extension, the python binary creates the coredump, so ABRT always blames the python package, but we want to blame the app that uses the extension instead
Diffstat (limited to 'src/Daemon')
-rw-r--r--src/Daemon/MiddleWare.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index b597a411..98feb7b8 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -781,6 +781,33 @@ std::string getDebugDumpDir(const char *pUUID,
return row.m_sDebugDumpDir;
}
+static char *guess_app_path(const char* cmdline)
+{
+ const char *path_start = NULL;
+ char *app_path = NULL;
+ // +1 to skip the space
+ path_start = strchr(cmdline, ' ');
+ /* we found space in cmdline, so it might contain
+ path to some script like:
+ /usr/bin/python /usr/bin/system-control-network
+ */
+ if(path_start != NULL)
+ {
+ // skip the space
+ path_start++;
+ /* if the string following the space doesn't start
+ with '/' it's probably not a full path to app and
+ we can't use it to determine the package name
+ */
+ if(*path_start == '/'){
+ int len = strchrnul(path_start,' ') - path_start;
+ // cut the cmdline arguments
+ app_path = xstrndup(path_start, len);
+ }
+ }
+ return app_path;
+}
+
mw_result_t SaveDebugDump(const char *pDebugDumpDir,
map_crash_info_t& pCrashInfo)
{
@@ -788,6 +815,7 @@ mw_result_t SaveDebugDump(const char *pDebugDumpDir,
std::string time;
std::string analyzer;
std::string executable;
+ std::string cmdline;
try
{
CDebugDump dd;
@@ -796,6 +824,7 @@ mw_result_t SaveDebugDump(const char *pDebugDumpDir,
dd.LoadText(FILENAME_UID, UID);
dd.LoadText(FILENAME_ANALYZER, analyzer);
dd.LoadText(FILENAME_EXECUTABLE, executable);
+ dd.LoadText(FILENAME_CMDLINE, cmdline);
}
catch (CABRTException& e)
{
@@ -811,12 +840,31 @@ mw_result_t SaveDebugDump(const char *pDebugDumpDir,
{
return MW_IN_DB;
}
- mw_result_t res = SavePackageDescriptionToDebugDump(executable.c_str(), pDebugDumpDir);
+ /* first try to find package for the application guessed from cmdline
+ this will work only of the cmdline contains the whole path to the aplication
+ like:
+ /usr/bin/python /usr/bin/system-control-network
+ */
+ mw_result_t res = MW_PACKAGE_ERROR;
+ char *application = guess_app_path(cmdline.c_str());
+ if(application != NULL)
+ {
+ res = SavePackageDescriptionToDebugDump(application, pDebugDumpDir);
+ free(application);
+ }
+ if(res != MW_OK)
+ /* we didn't find the package, so the guess was probably wrong
+ try again with the executable
+ */
+ {
+ res = SavePackageDescriptionToDebugDump(executable.c_str(), pDebugDumpDir);
+ }
if (res != MW_OK)
{
return res;
}
+
std::string lUUID = GetLocalUUID(analyzer.c_str(), pDebugDumpDir);
const char *uid_str = analyzer_has_InformAllUsers(analyzer.c_str())
? "-1"