summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-12-14 10:41:51 +0100
committerKarel Klic <kklic@redhat.com>2009-12-14 10:41:51 +0100
commita24d2906c51e3740e6e0acf8f0093827b4e35bc3 (patch)
tree1022bf70766a88d45dc71d6ea413ccd0fa14d07c /src
parentb7ea0e53e3375de6298b2f510302f75ebef4be4e (diff)
parent42f0375d09931903965b36c87f17f805def956bf (diff)
downloadabrt-a24d2906c51e3740e6e0acf8f0093827b4e35bc3.tar.gz
abrt-a24d2906c51e3740e6e0acf8f0093827b4e35bc3.tar.xz
abrt-a24d2906c51e3740e6e0acf8f0093827b4e35bc3.zip
Merge branch 'master' of git://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src')
-rw-r--r--src/Applet/Applet.cpp5
-rw-r--r--src/Applet/CCApplet.cpp24
-rw-r--r--src/Applet/CCApplet.h5
-rw-r--r--src/Backtrace/main.c2
-rw-r--r--src/CLI/ABRTSocket.h8
-rw-r--r--src/CLI/CLI.cpp15
-rw-r--r--src/CLI/dbus.cpp73
-rw-r--r--src/CLI/dbus.h14
-rw-r--r--src/CLI/report.cpp150
-rw-r--r--src/CLI/report.h2
-rw-r--r--src/Daemon/CommLayerServer.h4
-rw-r--r--src/Daemon/CommLayerServerDBus.cpp45
-rw-r--r--src/Daemon/CommLayerServerDBus.h4
-rw-r--r--src/Daemon/CommLayerServerSocket.cpp4
-rw-r--r--src/Daemon/CommLayerServerSocket.h8
-rw-r--r--src/Daemon/CrashWatcher.cpp12
-rw-r--r--src/Daemon/CrashWatcher.h2
-rw-r--r--src/Daemon/Daemon.cpp10
-rw-r--r--src/Daemon/Makefile.am3
-rw-r--r--src/Daemon/MiddleWare.cpp22
-rw-r--r--src/Daemon/PluginManager.cpp18
-rw-r--r--src/Daemon/RPM.cpp2
-rwxr-xr-xsrc/Daemon/abrt-debuginfo-install2
-rw-r--r--src/Daemon/abrt.conf2
-rw-r--r--src/Daemon/abrtd.825
-rw-r--r--src/Gui/CCMainWindow.py50
-rw-r--r--src/Gui/CCReporterDialog.py20
-rw-r--r--src/Gui/CC_gui_functions.py23
-rw-r--r--src/Gui/Makefile.am3
-rwxr-xr-xsrc/Gui/abrt-gui4
-rw-r--r--src/Gui/ccgui.glade54
-rw-r--r--src/Gui/dialogs.glade62
-rw-r--r--src/Gui/report.glade22
-rw-r--r--src/Hooks/CCpp.cpp2
-rw-r--r--src/Hooks/Makefile.am19
-rw-r--r--src/Hooks/abrt-hook-python.cpp (renamed from src/Hooks/abrt-pyhook-helper.cpp)4
-rw-r--r--src/Hooks/abrt_exception_handler.py.in8
-rw-r--r--src/Hooks/pyhook.conf1
-rw-r--r--src/Hooks/pyhook.conf.516
-rw-r--r--src/Hooks/sitecustomize.py63
40 files changed, 501 insertions, 311 deletions
diff --git a/src/Applet/Applet.cpp b/src/Applet/Applet.cpp
index 46278c62..eea3ef79 100644
--- a/src/Applet/Applet.cpp
+++ b/src/Applet/Applet.cpp
@@ -135,14 +135,15 @@ static void NameOwnerChanged(DBusMessage* signal)
}
// hide icon if it's visible - as NM and don't show it, if it's not
- if(!new_owner[0])
+ if (!new_owner[0])
applet->HideIcon();
}
static DBusHandlerResult handle_message(DBusConnection* conn, DBusMessage* msg, void* user_data)
{
const char* member = dbus_message_get_member(msg);
- log("%s(member:'%s')", __func__, member);
+
+ VERB1 log("%s(member:'%s')", __func__, member);
int type = dbus_message_get_type(msg);
if (type != DBUS_MESSAGE_TYPE_SIGNAL)
diff --git a/src/Applet/CCApplet.cpp b/src/Applet/CCApplet.cpp
index c91b4e82..5d13ab87 100644
--- a/src/Applet/CCApplet.cpp
+++ b/src/Applet/CCApplet.cpp
@@ -114,7 +114,7 @@ CApplet::CApplet()
m_iAnimationStage = ICON_DEFAULT;
m_bIconsLoaded = load_icons();
/* - animation - */
- if(m_bIconsLoaded == true)
+ if (m_bIconsLoaded == true)
{
m_pStatusIcon = gtk_status_icon_new_from_pixbuf(icon_stages_buff[ICON_DEFAULT]);
}
@@ -244,7 +244,7 @@ void CApplet::ShowIcon()
{
gtk_status_icon_set_visible(m_pStatusIcon, true);
/* only animate if all icons are loaded, use the "gtk-warning" instead */
- if(m_bIconsLoaded)
+ if (m_bIconsLoaded)
animate_icon();
}
@@ -300,30 +300,34 @@ void CApplet::Enable(const char *reason)
gboolean CApplet::update_icon(void *user_data)
{
CApplet* applet = (CApplet*)user_data;
- if(applet->m_pStatusIcon && applet->m_iAnimationStage < ICON_STAGE_LAST){
+ if (applet->m_pStatusIcon && applet->m_iAnimationStage < ICON_STAGE_LAST) {
gtk_status_icon_set_from_pixbuf(applet->m_pStatusIcon,
applet->icon_stages_buff[applet->m_iAnimationStage++]);
}
else
error_msg("icon is null");
- if(applet->m_iAnimationStage == ICON_STAGE_LAST){
+ if (applet->m_iAnimationStage == ICON_STAGE_LAST) {
applet->m_iAnimationStage = 0;
}
+ if (--applet->m_iAnimCountdown == 0) {
+ applet->stop_animate_icon();
+ }
return true;
}
void CApplet::animate_icon()
{
- if(m_iAnimator == 0)
+ if (m_iAnimator == 0)
{
m_iAnimator = g_timeout_add(100, update_icon, this);
+ m_iAnimCountdown = 10 * 60; /* 60 sec */
}
}
void CApplet::stop_animate_icon()
{
/* animator should be 0 if icons are not loaded, so this should be safe */
- if(m_iAnimator != 0){
+ if (m_iAnimator != 0) {
g_source_remove(m_iAnimator);
gtk_status_icon_set_from_pixbuf(m_pStatusIcon, icon_stages_buff[ICON_DEFAULT]);
m_iAnimator = 0;
@@ -333,13 +337,13 @@ void CApplet::stop_animate_icon()
bool CApplet::load_icons()
{
int stage;
- for(stage = ICON_DEFAULT; stage < ICON_STAGE_LAST; stage++)
+ for (stage = ICON_DEFAULT; stage < ICON_STAGE_LAST; stage++)
{
char name[sizeof(ICON_DIR"/abrt%02d.png")];
GError *error = NULL;
- if(snprintf(name, sizeof(ICON_DIR"/abrt%02d.png"),ICON_DIR"/abrt%02d.png", stage) > 0){
+ if (snprintf(name, sizeof(ICON_DIR"/abrt%02d.png"), ICON_DIR"/abrt%02d.png", stage) > 0) {
icon_stages_buff[stage] = gdk_pixbuf_new_from_file(name, &error);
- if(error != NULL){
+ if (error != NULL) {
error_msg("Can't load pixbuf from %s, animation is disabled!", name);
return false;
}
@@ -349,7 +353,7 @@ bool CApplet::load_icons()
}
-//int CApplet::AddEvent(int pUUID, const std::string& pProgname)
+//int CApplet::AddEvent(int pUUID, const char *pProgname)
//{
// m_mapEvents[pUUID] = "pProgname";
// SetIconTooltip(_("Pending events: %i"), m_mapEvents.size());
diff --git a/src/Applet/CCApplet.h b/src/Applet/CCApplet.h
index c5396a72..48dbabcc 100644
--- a/src/Applet/CCApplet.h
+++ b/src/Applet/CCApplet.h
@@ -41,6 +41,7 @@ class CApplet
bool m_bDaemonRunning;
int m_iAnimationStage;
guint m_iAnimator;
+ unsigned m_iAnimCountdown;
bool m_bIconsLoaded;
enum ICON_STAGES
@@ -71,12 +72,12 @@ class CApplet
// or ask the daemon every time?
// maybe just events which occured during current session
// map::
-// int AddEvent(int pUUID, const std::string& pProgname);
+// int AddEvent(int pUUID, const char *pProgname);
// int RemoveEvent(int pUUID);
protected:
//@@TODO applet menus
- static void OnAppletActivate_CB(GtkStatusIcon *status_icon,gpointer user_data);
+ static void OnAppletActivate_CB(GtkStatusIcon *status_icon, gpointer user_data);
static void OnMenuPopup_cb(GtkStatusIcon *status_icon,
guint button,
guint activate_time,
diff --git a/src/Backtrace/main.c b/src/Backtrace/main.c
index 9be93ca5..8add8c42 100644
--- a/src/Backtrace/main.c
+++ b/src/Backtrace/main.c
@@ -148,7 +148,7 @@ int main(int argc, char **argv)
if (size > FILE_SIZE_LIMIT)
{
- fprintf(stderr, "Input file too big (%zd). Maximum size is %zd.\n",
+ fprintf(stderr, "Input file too big (%zd). Maximum size is %d.\n",
size, FILE_SIZE_LIMIT);
exit(EX_IOERR);
}
diff --git a/src/CLI/ABRTSocket.h b/src/CLI/ABRTSocket.h
index 5d5383fa..c3a63e51 100644
--- a/src/CLI/ABRTSocket.h
+++ b/src/CLI/ABRTSocket.h
@@ -10,20 +10,20 @@ class CABRTSocket
private:
int m_nSocket;
- void Send(const std::string& pMessage);
+ void Send(const char *pMessage);
void Recv(std::string& pMessage);
public:
CABRTSocket();
~CABRTSocket();
- void Connect(const std::string& pPath);
+ void Connect(const char *pPath);
void Disconnect();
vector_crash_infos_t GetCrashInfos();
- map_crash_report_t CreateReport(const std::string& pUUID);
+ map_crash_report_t CreateReport(const char *pUUID);
void Report(const map_crash_report_t& pReport);
- void DeleteDebugDump(const std::string& pUUID);
+ int32_t DeleteDebugDump(const char *pUUID);
};
#endif /* ABRTSOCKET_H_ */
diff --git a/src/CLI/CLI.cpp b/src/CLI/CLI.cpp
index 9f2db3f0..1ea3a5d6 100644
--- a/src/CLI/CLI.cpp
+++ b/src/CLI/CLI.cpp
@@ -131,7 +131,7 @@ int main(int argc, char** argv)
char* uuid = NULL;
int op = -1;
- setlocale(LC_ALL,"");
+ setlocale(LC_ALL, "");
#if ENABLE_NLS
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
@@ -183,6 +183,7 @@ int main(int argc, char** argv)
ABRTDaemon.Connect(VAR_RUN"/abrt.socket");
#endif
+ int exitcode = 0;
switch (op)
{
case OPT_GET_LIST:
@@ -193,14 +194,18 @@ int main(int argc, char** argv)
break;
}
case OPT_REPORT:
- report(uuid, false);
+ exitcode = report(uuid, false);
break;
case OPT_REPORT_ALWAYS:
- report(uuid, true);
+ exitcode = report(uuid, true);
break;
case OPT_DELETE:
{
- call_DeleteDebugDump(uuid);
+ if (call_DeleteDebugDump(uuid) != 0)
+ {
+ log("Can't delete debug dump with UUID '%s'", uuid);
+ exitcode = 1;
+ }
break;
}
}
@@ -209,5 +214,5 @@ int main(int argc, char** argv)
ABRTDaemon.Disconnect();
#endif
- return 0;
+ return exitcode;
}
diff --git a/src/CLI/dbus.cpp b/src/CLI/dbus.cpp
index 67c489e0..b2186798 100644
--- a/src/CLI/dbus.cpp
+++ b/src/CLI/dbus.cpp
@@ -106,79 +106,99 @@ static DBusMessage* send_get_reply_and_unref(DBusMessage* msg)
vector_crash_infos_t call_GetCrashInfos()
{
- DBusMessage* msg = new_call_msg("GetCrashInfos");
+ DBusMessage* msg = new_call_msg(__func__ + 5);
DBusMessage *reply = send_get_reply_and_unref(msg);
- vector_crash_infos_t argout;
DBusMessageIter in_iter;
dbus_message_iter_init(reply, &in_iter);
+
+ vector_crash_infos_t argout;
int r = load_val(&in_iter, argout);
if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */
- error_msg_and_die("dbus call %s: return type mismatch", "GetCrashInfos");
+ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5);
+
dbus_message_unref(reply);
return argout;
}
map_crash_report_t call_CreateReport(const char* uuid)
{
- DBusMessage* msg = new_call_msg("CreateReport");
+ DBusMessage* msg = new_call_msg(__func__ + 5);
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &uuid,
DBUS_TYPE_INVALID);
DBusMessage *reply = send_get_reply_and_unref(msg);
- map_crash_report_t argout;
DBusMessageIter in_iter;
dbus_message_iter_init(reply, &in_iter);
+
+ map_crash_report_t argout;
int r = load_val(&in_iter, argout);
if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */
- error_msg_and_die("dbus call %s: return type mismatch", "CreateReport");
+ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5);
+
dbus_message_unref(reply);
return argout;
}
-void call_Report(const map_crash_report_t& report)
+report_status_t call_Report(const map_crash_report_t& report)
{
- DBusMessage* msg = new_call_msg("Report");
+ DBusMessage* msg = new_call_msg(__func__ + 5);
DBusMessageIter out_iter;
dbus_message_iter_init_append(msg, &out_iter);
store_val(&out_iter, report);
DBusMessage *reply = send_get_reply_and_unref(msg);
- //it returns a single value of report_status_t type,
- //but we don't use it (yet?)
+
+ DBusMessageIter in_iter;
+ dbus_message_iter_init(reply, &in_iter);
+
+ report_status_t result;
+ int r = load_val(&in_iter, result);
+ if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */
+ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5);
dbus_message_unref(reply);
+ return result;
}
-void call_DeleteDebugDump(const char* uuid)
+int32_t call_DeleteDebugDump(const char* uuid)
{
- DBusMessage* msg = new_call_msg("DeleteDebugDump");
+ DBusMessage* msg = new_call_msg(__func__ + 5);
dbus_message_append_args(msg,
DBUS_TYPE_STRING, &uuid,
DBUS_TYPE_INVALID);
DBusMessage *reply = send_get_reply_and_unref(msg);
- //it returns a single boolean value,
- //but we don't use it (yet?)
+
+ DBusMessageIter in_iter;
+ dbus_message_iter_init(reply, &in_iter);
+
+ int32_t result;
+ int r = load_val(&in_iter, result);
+ if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */
+ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5);
dbus_message_unref(reply);
+ return result;
}
vector_map_string_t call_GetPluginsInfo()
{
- DBusMessage *msg = new_call_msg("GetPluginsInfo");
- DBusMessage *reply = send_get_reply_and_unref(msg);
-
- vector_map_string_t argout;
- DBusMessageIter in_iter;
- dbus_message_iter_init(reply, &in_iter);
- int r = load_val(&in_iter, argout);
- if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */
- error_msg_and_die("dbus call GetPluginsInfo: return type mismatch");
- dbus_message_unref(reply);
- return argout;
+ DBusMessage *msg = new_call_msg(__func__ + 5);
+ DBusMessage *reply = send_get_reply_and_unref(msg);
+
+ DBusMessageIter in_iter;
+ dbus_message_iter_init(reply, &in_iter);
+
+ vector_map_string_t argout;
+ int r = load_val(&in_iter, argout);
+ if (r != ABRT_DBUS_LAST_FIELD) /* more values present, or bad type */
+ error_msg_and_die("dbus call %s: return type mismatch", __func__ + 5);
+
+ dbus_message_unref(reply);
+ return argout;
}
void handle_dbus_err(bool error_flag, DBusError *err)
@@ -193,6 +213,7 @@ void handle_dbus_err(bool error_flag, DBusError *err)
return;
error_msg_and_die(
"error requesting DBus name %s, possible reasons: "
- "abrt run by non-root; dbus config is incorrect",
+ "abrt run by non-root; dbus config is incorrect; "
+ "or dbus daemon needs to be restarted to reload dbus config",
ABRTD_DBUS_NAME);
}
diff --git a/src/CLI/dbus.h b/src/CLI/dbus.h
index 48d391e6..3c157c01 100644
--- a/src/CLI/dbus.h
+++ b/src/CLI/dbus.h
@@ -23,21 +23,21 @@
extern DBusConnection* s_dbus_conn;
-extern vector_crash_infos_t call_GetCrashInfos();
-extern map_crash_report_t call_CreateReport(const char *uuid);
-extern void call_Report(const map_crash_report_t& report);
-extern void call_DeleteDebugDump(const char* uuid);
+vector_crash_infos_t call_GetCrashInfos();
+map_crash_report_t call_CreateReport(const char *uuid);
+report_status_t call_Report(const map_crash_report_t& report);
+int32_t call_DeleteDebugDump(const char* uuid);
/* Gets basic data about all installed plugins.
*/
-extern vector_map_string_t call_GetPluginsInfo();
+vector_map_string_t call_GetPluginsInfo();
/** Gets default plugin settings.
* @param name
* Corresponds to name obtained from call_GetPluginsInfo.
*/
-extern map_plugin_settings_t call_GetPluginSettings(const char *name);
+map_plugin_settings_t call_GetPluginSettings(const char *name);
-extern void handle_dbus_err(bool error_flag, DBusError *err);
+void handle_dbus_err(bool error_flag, DBusError *err);
#endif
diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp
index ac80e481..bc8f9008 100644
--- a/src/CLI/report.cpp
+++ b/src/CLI/report.cpp
@@ -332,88 +332,98 @@ int report(const char *uuid, bool always)
{
// Ask for an initial report.
map_crash_report_t cr = call_CreateReport(uuid);
+//TODO: error check?
- if (always)
+ if (!always)
{
- // Send the report immediately.
- call_Report(cr);
- return 0;
- }
-
- /* Open a temporary file and write the crash report to it. */
- char filename[] = "/tmp/abrt-report.XXXXXX";
- int fd = mkstemp(filename);
- if (fd == -1)
- {
- error_msg("can't generate temporary file name");
- return 1;
- }
+ /* Open a temporary file and write the crash report to it. */
+ char filename[] = "/tmp/abrt-report.XXXXXX";
+ int fd = mkstemp(filename);
+ if (fd == -1)
+ {
+ error_msg("can't generate temporary file name");
+ return 1;
+ }
- FILE *fp = fdopen(fd, "w");
- if (!fp)
- {
- error_msg("can't open '%s' to save the crash report", filename);
- return 1;
- }
+ FILE *fp = fdopen(fd, "w");
+ if (!fp)
+ {
+ error_msg("can't open '%s' to save the crash report", filename);
+ return 1;
+ }
- write_crash_report(cr, fp);
+ write_crash_report(cr, fp);
- if (fclose(fp))
- {
- error_msg("can't close '%s'", filename);
- return 2;
- }
+ if (fclose(fp))
+ {
+ error_msg("can't close '%s'", filename);
+ return 2;
+ }
- // Start a text editor on the temporary file.
- launch_editor(filename);
+ // Start a text editor on the temporary file.
+ launch_editor(filename);
- // Read the file back and update the report from the file.
- fp = fopen(filename, "r");
- if (!fp)
- {
- error_msg("can't open '%s' to read the crash report", filename);
- return 1;
- }
+ // Read the file back and update the report from the file.
+ fp = fopen(filename, "r");
+ if (!fp)
+ {
+ error_msg("can't open '%s' to read the crash report", filename);
+ return 1;
+ }
- fseek(fp, 0, SEEK_END);
- long size = ftell(fp);
- fseek(fp, 0, SEEK_SET);
+ fseek(fp, 0, SEEK_END);
+ long size = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
- char *text = (char*)xmalloc(size + 1);
- if (fread(text, 1, size, fp) != size)
- {
- error_msg("can't read '%s'", filename);
- return 1;
+ char *text = (char*)xmalloc(size + 1);
+ if (fread(text, 1, size, fp) != size)
+ {
+ error_msg("can't read '%s'", filename);
+ return 1;
+ }
+ text[size] = '\0';
+ fclose(fp);
+
+ remove_comments_and_unescape(text);
+ // Updates the crash report from the file text.
+ int report_changed = read_crash_report(cr, text);
+ if (report_changed)
+ puts(_("\nThe report has been updated."));
+ else
+ puts(_("\nNo changes were detected in the report."));
+
+ free(text);
+
+ if (unlink(filename) != 0) // Delete the tempfile.
+ perror_msg("can't unlink %s", filename);
+
+ // Report only if the user is sure.
+ printf(_("Do you want to send the report? [y/N]: "));
+ fflush(NULL);
+ char answer[16] = "n";
+ fgets(answer, sizeof(answer), stdin);
+ if ((answer[0] | 0x20) != 'y')
+ {
+ puts(_("Crash report was not sent."));
+ return 0;
+ }
}
- text[size] = '\0';
- fclose(fp);
-
- remove_comments_and_unescape(text);
- // Updates the crash report from the file text.
- int report_changed = read_crash_report(cr, text);
- if (report_changed)
- puts(_("\nThe report has been updated."));
- else
- puts(_("\nNo changes were detected in the report."));
- free(text);
-
- if (unlink(filename) != 0) // Delete the tempfile.
- perror_msg("can't unlink %s", filename);
-
- // Report only if the user is sure.
- printf(_("Do you want to send the report? [y/N]: "));
- fflush(NULL);
- char answer[16] = "n";
- fgets(answer, sizeof(answer), stdin);
- if (answer[0] == 'Y' || answer[0] == 'y')
+ int errors = 0;
+ int plugins = 0;
+ puts(_("Reporting..."));
+ report_status_t r = call_Report(cr);
+ report_status_t::iterator it = r.begin();
+ while (it != r.end())
{
- puts(_("Reporting..."));
- call_Report(cr);
- puts(_("Crash report was successfully sent."));
+ vector_string_t &v = it->second;
+ printf("%s: %s\n", it->first.c_str(), v[REPORT_STATUS_IDX_MSG].c_str());
+ plugins++;
+ if (v[REPORT_STATUS_IDX_FLAG] != "0")
+ errors++;
+ it++;
}
- else
- puts(_("Crash report was not sent."));
+ printf(_("Crash reported via %d plugins (%d errors)\n"), plugins, errors);
- return 0;
+ return errors != 0;
}
diff --git a/src/CLI/report.h b/src/CLI/report.h
index 888babf3..2969b650 100644
--- a/src/CLI/report.h
+++ b/src/CLI/report.h
@@ -19,6 +19,6 @@
#define ABRT_CLI_REPORT_H
/* Reports the crash with corresponding uuid over DBus. */
-extern int report(const char *uuid, bool always);
+int report(const char *uuid, bool always);
#endif
diff --git a/src/Daemon/CommLayerServer.h b/src/Daemon/CommLayerServer.h
index 21c1b304..367c0956 100644
--- a/src/Daemon/CommLayerServer.h
+++ b/src/Daemon/CommLayerServer.h
@@ -17,8 +17,8 @@ class CCommLayerServer {
virtual void JobDone(const char* pDest, const char* pUUID) = 0;
virtual void QuotaExceed(const char* str) {}
- virtual void Update(const std::string& pMessage, const char* peer, uint64_t pJobID) {};
- virtual void Warning(const std::string& pMessage, const char* peer, uint64_t pJobID) {};
+ virtual void Update(const char* pMessage, const char* peer, uint64_t pJobID) {};
+ virtual void Warning(const char* pMessage, const char* peer, uint64_t pJobID) {};
};
#endif
diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp
index 27a18c24..9222c594 100644
--- a/src/Daemon/CommLayerServerDBus.cpp
+++ b/src/Daemon/CommLayerServerDBus.cpp
@@ -88,23 +88,21 @@ void CCommLayerServerDBus::JobDone(const char* peer, const char* pUUID)
send_flush_and_unref(msg);
}
-void CCommLayerServerDBus::Update(const std::string& pMessage, const char* peer, uint64_t job_id)
+void CCommLayerServerDBus::Update(const char* pMessage, const char* peer, uint64_t job_id)
{
DBusMessage* msg = new_signal_msg("Update", peer);
- const char* c_message = pMessage.c_str();
dbus_message_append_args(msg,
- DBUS_TYPE_STRING, &c_message,
+ DBUS_TYPE_STRING, &pMessage,
DBUS_TYPE_UINT64, &job_id, /* TODO: redundant parameter, remove from API */
DBUS_TYPE_INVALID);
send_flush_and_unref(msg);
}
-void CCommLayerServerDBus::Warning(const std::string& pMessage, const char* peer, uint64_t job_id)
+void CCommLayerServerDBus::Warning(const char* pMessage, const char* peer, uint64_t job_id)
{
DBusMessage* msg = new_signal_msg("Warning", peer);
- const char* c_message = pMessage.c_str();
dbus_message_append_args(msg,
- DBUS_TYPE_STRING, &c_message,
+ DBUS_TYPE_STRING, &pMessage,
DBUS_TYPE_UINT64, &job_id, /* TODO: redundant parameter, remove from API */
DBUS_TYPE_INVALID);
send_flush_and_unref(msg);
@@ -137,9 +135,9 @@ static int handle_GetCrashInfos(DBusMessage* call, DBusMessage* reply)
long unix_uid = get_remote_uid(call);
vector_crash_infos_t argout1 = GetCrashInfos(to_string(unix_uid).c_str());
- DBusMessageIter iter;
- dbus_message_iter_init_append(reply, &iter);
- store_val(&iter, argout1);
+ DBusMessageIter out_iter;
+ dbus_message_iter_init_append(reply, &out_iter);
+ store_val(&out_iter, argout1);
send_flush_and_unref(reply);
return 0;
@@ -315,7 +313,11 @@ static int handle_DeleteDebugDump(DBusMessage* call, DBusMessage* reply)
}
long unix_uid = get_remote_uid(call);
- DeleteDebugDump(argin1, to_string(unix_uid).c_str());
+ int32_t result = DeleteDebugDump(argin1, to_string(unix_uid).c_str());
+
+ DBusMessageIter out_iter;
+ dbus_message_iter_init_append(reply, &out_iter);
+ store_val(&out_iter, result);
send_flush_and_unref(reply);
return 0;
@@ -325,9 +327,9 @@ static int handle_GetPluginsInfo(DBusMessage* call, DBusMessage* reply)
{
vector_map_string_t plugins_info = g_pPluginManager->GetPluginsInfo();
- DBusMessageIter iter;
- dbus_message_iter_init_append(reply, &iter);
- store_val(&iter, plugins_info);
+ DBusMessageIter out_iter;
+ dbus_message_iter_init_append(reply, &out_iter);
+ store_val(&out_iter, plugins_info);
send_flush_and_unref(reply);
return 0;
@@ -350,9 +352,10 @@ static int handle_GetPluginSettings(DBusMessage* call, DBusMessage* reply)
VERB1 log("got %s('%s') call from uid %ld", "GetPluginSettings", PluginName, unix_uid);
map_plugin_settings_t plugin_settings = g_pPluginManager->GetPluginSettings(PluginName, to_string(unix_uid).c_str());
- DBusMessageIter iter;
- dbus_message_iter_init_append(reply, &iter);
- store_val(&iter, plugin_settings);
+ DBusMessageIter out_iter;
+ dbus_message_iter_init_append(reply, &out_iter);
+ store_val(&out_iter, plugin_settings);
+
send_flush_and_unref(reply);
return 0;
}
@@ -434,9 +437,10 @@ static int handle_GetSettings(DBusMessage* call, DBusMessage* reply)
{
map_abrt_settings_t result = GetSettings();
- DBusMessageIter iter;
- dbus_message_iter_init_append(reply, &iter);
- store_val(&iter, result);
+ DBusMessageIter out_iter;
+ dbus_message_iter_init_append(reply, &out_iter);
+ store_val(&out_iter, result);
+
send_flush_and_unref(reply);
return 0;
}
@@ -540,7 +544,8 @@ static void handle_dbus_err(bool error_flag, DBusError *err)
return;
error_msg_and_die(
"Error requesting DBus name %s, possible reasons: "
- "abrt run by non-root; dbus config is incorrect",
+ "abrt run by non-root; dbus config is incorrect; "
+ "or dbus daemon needs to be restarted to reload dbus config",
ABRTD_DBUS_NAME);
}
diff --git a/src/Daemon/CommLayerServerDBus.h b/src/Daemon/CommLayerServerDBus.h
index f159c732..9bd77666 100644
--- a/src/Daemon/CommLayerServerDBus.h
+++ b/src/Daemon/CommLayerServerDBus.h
@@ -15,8 +15,8 @@ class CCommLayerServerDBus
virtual void JobDone(const char* pDest, const char* pUUID);
virtual void QuotaExceed(const char* str);
- virtual void Update(const std::string& pMessage, const char* peer, uint64_t pJobID);
- virtual void Warning(const std::string& pMessage, const char* peer, uint64_t pJobID);
+ virtual void Update(const char* pMessage, const char* peer, uint64_t pJobID);
+ virtual void Warning(const char* pMessage, const char* peer, uint64_t pJobID);
};
#endif
diff --git a/src/Daemon/CommLayerServerSocket.cpp b/src/Daemon/CommLayerServerSocket.cpp
index ee775c6d..0c5f2e31 100644
--- a/src/Daemon/CommLayerServerSocket.cpp
+++ b/src/Daemon/CommLayerServerSocket.cpp
@@ -40,7 +40,7 @@ std::string CCommLayerServerSocket::GetSenderUID(int pSenderSocket)
socklen_t len = sizeof(creds);
if (getsockopt(pSenderSocket, SOL_SOCKET, SO_PEERCRED, &creds, &len) == -1)
{
- throw CABRTException(EXCEP_ERROR, "CCommLayerServerSocket::GetSenderUID(): Error can get sender uid.");
+ throw CABRTException(EXCEP_ERROR, "CCommLayerServerSocket::GetSenderUID(): error getting sender uid");
}
return to_string(creds.uid);
}
@@ -219,7 +219,7 @@ vector_crash_infos_t CCommLayerServerSocket::GetCrashInfos(const std::string &pS
}
//reimplement as CreateReportThread(...)?
-//map_crash_report_t CCommLayerServerSocket::CreateReport(const std::string &pUUID,const std::string &pSender)
+//map_crash_report_t CCommLayerServerSocket::CreateReport(const std::string &pUUID, const std::string &pSender)
//{
// map_crash_report_t crashReport;
// crashReport = ::CreateReport(pUUID, pSender);
diff --git a/src/Daemon/CommLayerServerSocket.h b/src/Daemon/CommLayerServerSocket.h
index d1f464cc..753b67af 100644
--- a/src/Daemon/CommLayerServerSocket.h
+++ b/src/Daemon/CommLayerServerSocket.h
@@ -26,9 +26,9 @@ class CCommLayerServerSocket : public CCommLayerServer
CCommLayerServerSocket();
virtual ~CCommLayerServerSocket();
- virtual vector_crash_infos_t GetCrashInfos(const std::string& pSender);
- virtual report_status_t Report(const map_crash_report_t& pReport, const std::string& pSender);
- virtual void DeleteDebugDump(const std::string& pUUID, const std::string& pSender);
+ virtual vector_crash_infos_t GetCrashInfos(const char *pSender);
+ virtual report_status_t Report(const map_crash_report_t& pReport, const char *pSender);
+ virtual void DeleteDebugDump(const char *pUUID, const char *pSender);
- virtual void Crash(const std::string& arg1);
+ virtual void Crash(const char *arg1);
};
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp
index 1606f86d..88c058b0 100644
--- a/src/Daemon/CrashWatcher.cpp
+++ b/src/Daemon/CrashWatcher.cpp
@@ -73,6 +73,8 @@ vector_crash_infos_t GetCrashInfos(const char *pUID)
/* Deletes both DB record and dump dir */
DeleteDebugDump(uuid, uid);
break;
+ default:
+ break;
}
}
}
@@ -191,7 +193,7 @@ int CreateReportThread(const char* pUUID, const char* pUID, int force, const cha
/* Remove dump dir and its DB record */
-void DeleteDebugDump(const char *pUUID, const char *pUID)
+int DeleteDebugDump(const char *pUUID, const char *pUID)
{
try
{
@@ -201,12 +203,18 @@ void DeleteDebugDump(const char *pUUID, const char *pUID)
database->DeleteRow(pUUID, pUID);
database->DisConnect();
- delete_debug_dump_dir(row.m_sDebugDumpDir.c_str());
+ const char *dump_dir = row.m_sDebugDumpDir.c_str();
+ if (dump_dir[0] != '\0')
+ {
+ delete_debug_dump_dir(dump_dir);
+ return 0; /* success */
+ }
}
catch (CABRTException& e)
{
error_msg("%s", e.what());
}
+ return -1; /* failure */
}
void DeleteDebugDump_by_dir(const char *dump_dir)
diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h
index a8064367..8d56c4ec 100644
--- a/src/Daemon/CrashWatcher.h
+++ b/src/Daemon/CrashWatcher.h
@@ -51,7 +51,7 @@ class CCrashWatcher
vector_crash_infos_t GetCrashInfos(const char *pUID);
int CreateReportThread(const char* pUUID, const char* pUID, int force, const char* pSender);
map_crash_report_t CreateReport(const char* pUUID, const char* pUID, int force);
-void DeleteDebugDump(const char *pUUID, const char *pUID);
+int DeleteDebugDump(const char *pUUID, const char *pUID);
void DeleteDebugDump_by_dir(const char *dump_dir);
#endif
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index 54fc93f4..3971a2cc 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -64,7 +64,7 @@
* "Please report this crash": calls Report() of all registered reporter plugins.
* Returns report_status_t (map_vector_string_t) - the status of each call.
* 2nd parameter is the contents of user's abrt.conf.
- * - DeleteDebugDump(UUID): delete corresponding /var/cache/abrt/DIR. Returns bool
+ * - DeleteDebugDump(UUID): delete it from DB and delete corresponding /var/cache/abrt/DIR
* - GetPluginsInfo(): returns vector_map_string_t
* - GetPluginSettings(PluginName): returns map_plugin_settings_t (map_string_t)
* - SetPluginSettings(PluginName, map_plugin_settings_t): returns void
@@ -456,6 +456,12 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin
continue;
}
+//TODO: make it possible to detect when ccpp didn't finish dumping yet.
+//We are seeing it *before* ccpp finished, and it can take LONG time
+//(users saw 100+ seconds).
+//This floods syslog with "Lock file 'XXXXXX' is locked by process NNN"
+//Maybe ccpp should use XXXXXX.new name for incomplete dumps
+//and abrtd should watch for renames XXXXXX.new -> XXXXXX?
log("Directory '%s' creation detected", name);
std::string worst_dir;
@@ -667,7 +673,7 @@ int main(int argc, char** argv)
int opt;
int parent_pid = getpid();
- setlocale(LC_ALL,"");
+ setlocale(LC_ALL, "");
#if ENABLE_NLS
bindtextdomain(PACKAGE, LOCALEDIR);
diff --git a/src/Daemon/Makefile.am b/src/Daemon/Makefile.am
index fc4f5e20..18fcd816 100644
--- a/src/Daemon/Makefile.am
+++ b/src/Daemon/Makefile.am
@@ -26,7 +26,8 @@ abrtd_CPPFLAGS = \
$(DBUS_CFLAGS) \
$(XMLRPC_CFLAGS) $(XMLRPC_CLIENT_CFLAGS) \
$(ENABLE_SOCKET_OR_DBUS) \
- -D_GNU_SOURCE
+ -D_GNU_SOURCE \
+ -Wall
abrtd_LDADD = \
../../lib/Utils/libABRTUtils.la \
../../lib/Utils/libABRTdUtils.la \
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index 8528f644..5235c172 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -348,7 +348,7 @@ void RunActionsAndReporters(const char *pDebugDumpDir)
map_crash_report_t crashReport;
DebugDumpToCrashReport(pDebugDumpDir, crashReport);
VERB2 log("%s.Report(...)", it_ar->first.c_str());
- reporter->Report(crashReport, plugin_settings, it_ar->second);
+ reporter->Report(crashReport, plugin_settings, it_ar->second.c_str());
}
else if (tp == ACTION)
{
@@ -427,12 +427,12 @@ report_status_t Report(const map_crash_report_t& pCrashReport,
std::string packageNVR = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT];
std::string packageName = packageNVR.substr(0, packageNVR.rfind("-", packageNVR.rfind("-") - 1));
- // Save comments and how to reproduciton
+ // Save comment and "how to reproduce"
map_crash_report_t::const_iterator it_comment = pCrashReport.find(CD_COMMENT);
map_crash_report_t::const_iterator it_reproduce = pCrashReport.find(CD_REPRODUCE);
- std::string pDumpDir = getDebugDumpDir(UUID.c_str(), UID.c_str());
-
+ if (it_comment != pCrashReport.end() || it_reproduce != pCrashReport.end())
{
+ std::string pDumpDir = getDebugDumpDir(UUID.c_str(), UID.c_str());
CDebugDump dd;
dd.Open(pDumpDir.c_str());
if (it_comment != pCrashReport.end())
@@ -490,7 +490,7 @@ report_status_t Report(const map_crash_report_t& pCrashReport,
}
#endif
map_plugin_settings_t plugin_settings = pSettings[pluginName];
- std::string res = reporter->Report(pCrashReport, plugin_settings, it_r->second);
+ std::string res = reporter->Report(pCrashReport, plugin_settings, it_r->second.c_str());
#if 0 /* Using ~user/.abrt/ is bad wrt security */
if (home != "")
@@ -498,15 +498,15 @@ report_status_t Report(const map_crash_report_t& pCrashReport,
reporter->SetSettings(oldSettings);
}
#endif
- ret[pluginName].push_back("1");
- ret[pluginName].push_back(res);
+ ret[pluginName].push_back("1"); // REPORT_STATUS_IDX_FLAG
+ ret[pluginName].push_back(res); // REPORT_STATUS_IDX_MSG
message += res + "\n";
}
}
catch (CABRTException& e)
{
- ret[pluginName].push_back("0");
- ret[pluginName].push_back(e.what());
+ ret[pluginName].push_back("0"); // REPORT_STATUS_IDX_FLAG
+ ret[pluginName].push_back(e.what()); // REPORT_STATUS_IDX_MSG
update_client("Reporting via '%s' was not successful: %s", pluginName.c_str(), e.what());
}
}
@@ -604,6 +604,8 @@ static mw_result_t SavePackageDescriptionToDebugDump(const char *pExecutable,
}
std::string description = GetDescription(packageName.c_str());
+//TODO: if executable in /usr/bin/python, /bin/sh and such,
+//we need to extract component using argv[1]
std::string component = GetComponent(pExecutable);
try
@@ -688,7 +690,7 @@ void autoreport(const pair_string_string_t& reporter_options, const map_crash_re
}
map_plugin_settings_t plugin_settings;
- std::string res = reporter->Report(crash_report, plugin_settings, reporter_options.second);
+ std::string res = reporter->Report(crash_report, plugin_settings, reporter_options.second.c_str());
}
/**
diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp
index 58151b29..82f22e85 100644
--- a/src/Daemon/PluginManager.cpp
+++ b/src/Daemon/PluginManager.cpp
@@ -286,11 +286,11 @@ CAnalyzer* CPluginManager::GetAnalyzer(const char *pName)
map_plugins_t::iterator plugin = m_mapPlugins.find(pName);
if (plugin == m_mapPlugins.end())
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not registered", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not registered", pName);
}
if (m_mapABRTPlugins[pName]->GetType() != ANALYZER)
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not an analyzer plugin", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not an analyzer plugin", pName);
}
return (CAnalyzer*)(plugin->second);
}
@@ -300,11 +300,11 @@ CReporter* CPluginManager::GetReporter(const char *pName)
map_plugins_t::iterator plugin = m_mapPlugins.find(pName);
if (plugin == m_mapPlugins.end())
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not registered", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not registered", pName);
}
if (m_mapABRTPlugins[pName]->GetType() != REPORTER)
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not a reporter plugin", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not a reporter plugin", pName);
}
return (CReporter*)(plugin->second);
}
@@ -314,11 +314,11 @@ CAction* CPluginManager::GetAction(const char *pName)
map_plugins_t::iterator plugin = m_mapPlugins.find(pName);
if (plugin == m_mapPlugins.end())
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not registered", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not registered", pName);
}
if (m_mapABRTPlugins[pName]->GetType() != ACTION)
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not an action plugin", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not an action plugin", pName);
}
return (CAction*)(plugin->second);
}
@@ -328,11 +328,11 @@ CDatabase* CPluginManager::GetDatabase(const char *pName)
map_plugins_t::iterator plugin = m_mapPlugins.find(pName);
if (plugin == m_mapPlugins.end())
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not registered", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not registered", pName);
}
if (m_mapABRTPlugins[pName]->GetType() != DATABASE)
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not a database plugin", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not a database plugin", pName);
}
return (CDatabase*)(plugin->second);
}
@@ -342,7 +342,7 @@ plugin_type_t CPluginManager::GetPluginType(const char *pName)
map_plugins_t::iterator plugin = m_mapPlugins.find(pName);
if (plugin == m_mapPlugins.end())
{
- throw CABRTException(EXCEP_PLUGIN, ssprintf("Plugin '%s' is not registered", pName));
+ throw CABRTException(EXCEP_PLUGIN, "Plugin '%s' is not registered", pName);
}
return m_mapABRTPlugins[pName]->GetType();
}
diff --git a/src/Daemon/RPM.cpp b/src/Daemon/RPM.cpp
index 4a819b5d..b3cf2c1c 100644
--- a/src/Daemon/RPM.cpp
+++ b/src/Daemon/RPM.cpp
@@ -146,7 +146,7 @@ std::string GetComponent(const char* pFileName)
if (header != NULL)
{
rpmtd td = rpmtdNew();
- headerGet(header,RPMTAG_SOURCERPM, td, HEADERGET_DEFAULT);
+ headerGet(header, RPMTAG_SOURCERPM, td, HEADERGET_DEFAULT);
const char * srpm = rpmtdGetString(td);
if (srpm != NULL)
{
diff --git a/src/Daemon/abrt-debuginfo-install b/src/Daemon/abrt-debuginfo-install
index 23379b46..6278b63c 100755
--- a/src/Daemon/abrt-debuginfo-install
+++ b/src/Daemon/abrt-debuginfo-install
@@ -148,7 +148,7 @@ print_package_names() {
yumopts="-C"
echo "`count_words $missing_debuginfo_files` missing debuginfos, getting package list from cache" >&2
else
- echo "`count_words $missing_debuginfo_files` missing debuginfos, getting package list" >&2
+ echo "`count_words $missing_debuginfo_files` missing debuginfos, getting package list from repositories" >&2
fi
local cmd="yum $yumopts --enablerepo=*debuginfo* --quiet provides $missing_debuginfo_files"
echo "$cmd" >"yum_provides.$1.OUT"
diff --git a/src/Daemon/abrt.conf b/src/Daemon/abrt.conf
index 028f582d..ee034a6c 100644
--- a/src/Daemon/abrt.conf
+++ b/src/Daemon/abrt.conf
@@ -4,7 +4,7 @@
[ Common ]
# With this option set to "yes",
# only crashes in signed packages will be analyzed.
-OpenGPGCheck = no
+OpenGPGCheck = yes
# GPG keys
OpenGPGPublicKeys = /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
# Blacklisted packages
diff --git a/src/Daemon/abrtd.8 b/src/Daemon/abrtd.8
index b106041d..150f0c3d 100644
--- a/src/Daemon/abrtd.8
+++ b/src/Daemon/abrtd.8
@@ -1,10 +1,10 @@
-.TH abrt "8" "28 May 2009" ""
+.TH abrtd "8" "28 May 2009" ""
.SH NAME
-abrt \- an automated bug-reporting tool
+abrtd \- automated bug reporting tool's daemon
.SH SYNOPSIS
-.B abrt [ -d ]
+.B abrtd [-dsv[v]...]
.SH DESCRIPTION
-.I abrt
+.I abrtd
is a daemon that watches for application crashes. When a crash occurs,
it collects the crash data (core file, application's command line etc.)
and takes action according to the type of application that
@@ -17,17 +17,22 @@ respective plugins.
.SH OPTIONS
.TP
-
.B "\-d"
-This option causes
-.I abrt
-to print more debugging information when the daemon is started.
+Stay in the foreground and log to standard error.
+.TP
+.B "\-s"
+
+Log to system log even with option -d.
+.TP
+.B "\-v"
+
+Log more detailed debugging information.
.SH CAVEATS
-When you use some other crash-catching tool, specific for an application
+When you use some other crash-catching tool specific for an application
or an application type (for example BugBuddy for GNOME applications),
crashes of this type will be handled by that tool and
-not by \fIabrt\fP. If you want \fIabrt\fP to handle these crashes,
+not by \fIabrtd\fP. If you want \fIabrtd\fP to handle these crashes,
turn off the higher-level crash-catching tool.
.SH "SEE ALSO"
.IR abrt.conf (5),
diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py
index 7de389bd..e429908e 100644
--- a/src/Gui/CCMainWindow.py
+++ b/src/Gui/CCMainWindow.py
@@ -28,6 +28,7 @@ class MainWindow():
ccdaemon = None
def __init__(self):
self.theme = gtk.icon_theme_get_default()
+ self.updates = ""
try:
self.ccdaemon = CCDBusBackend.DBusManager()
except ABRTExceptions.IsRunning, e:
@@ -44,21 +45,18 @@ class MainWindow():
#Get the Main Window, and connect the "destroy" event
self.window = self.wTree.get_widget("main_window3")
- self.window.set_default_size(700, 480)
- if (self.window):
+ if self.window:
+ self.window.set_default_size(700, 480)
self.window.connect("delete_event", self.delete_event_cb)
self.window.connect("destroy", self.destroy)
self.window.connect("focus-in-event", self.focus_in_cb)
- self.statusWindow = self.wTree.get_widget("pBarWindow")
- if self.statusWindow:
- self.statusWindow.connect("delete_event", self.sw_delete_event_cb)
-
- self.appBar = self.wTree.get_widget("appBar")
# pregress bar window to show while bt is being extracted
self.pBarWindow = self.wTree.get_widget("pBarWindow")
- self.pBarWindow.set_transient_for(self.window)
- self.pBar = self.wTree.get_widget("pBar")
+ if self.pBarWindow:
+ self.pBarWindow.connect("delete_event", self.sw_delete_event_cb)
+ self.pBarWindow.set_transient_for(self.window)
+ self.pBar = self.wTree.get_widget("pBar")
#init the dumps treeview
self.dlist = self.wTree.get_widget("tvDumps")
@@ -110,7 +108,6 @@ class MainWindow():
self.ccdaemon.connect("crash", self.on_data_changed_cb, None)
self.ccdaemon.connect("analyze-complete", self.on_analyze_complete_cb, self.pBarWindow)
self.ccdaemon.connect("abrt-error", self.error_cb)
- #self.ccdaemon.connect("warning", self.warning_cb)
self.ccdaemon.connect("update", self.update_cb)
self.ccdaemon.connect("show", self.show_cb)
self.ccdaemon.connect("daemon-state-changed", self.on_daemon_state_changed_cb)
@@ -153,16 +150,6 @@ class MainWindow():
return
dialog.show()
- def warning_cb(self, daemon, message=None):
- # try to hide the progressbar, we dont really care if it was visible ..
- try:
- #gobject.source_remove(self.timer)
- #self.pBarWindow.hide()
- pass
- except Exception, e:
- pass
- gui_error_message("%s" % message, parent_dialog=self.window)
-
def error_cb(self, daemon, message=None):
# try to hide the progressbar, we dont really care if it was visible ..
try:
@@ -173,8 +160,14 @@ class MainWindow():
gui_error_message(_("Unable to finish current task!\n%s" % message), parent_dialog=self.window)
def update_cb(self, daemon, message):
+ self.updates += message
+ if self.updates[-1] != '\n':
+ self.updates += '\n'
message = message.replace('\n',' ')
self.wTree.get_widget("lStatus").set_text(message)
+ buff = gtk.TextBuffer()
+ buff.set_text(self.updates)
+ self.wTree.get_widget("tvUpdates").set_buffer(buff)
# call to update the progressbar
def progress_update_cb(self, *args):
@@ -187,7 +180,7 @@ class MainWindow():
try:
dumplist = getDumpList(self.ccdaemon, refresh=True)
except Exception, e:
- # there is something wrong with the daemon if we can get the dumplist
+ # there is something wrong with the daemon if we cant get the dumplist
gui_error_message(_("Error while loading the dumplist.\n%s" % e))
# so we shouldn't continue..
sys.exit()
@@ -225,7 +218,9 @@ class MainWindow():
dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]), dumpsListStore.get_n_columns()-1)
#move this to Dump class
if dump.isReported():
- report_label = _("<b>This crash has been reported, you can find the report(s) at:</b>\n")
+ report_label = _("<b>This crash has been reported:</b>\n")
+ # plugin message follows, but at least in case of kerneloops,
+ # it is not informative (no URL to the report)
for message in dump.getMessage().split('\n'):
if message:
if "http" in message[0:5] or "file:///"[0:8] in message:
@@ -284,13 +279,12 @@ class MainWindow():
if not report:
gui_error_message(_("Unable to get report!\nDebuginfo is missing?"))
return
- report_dialog = ReporterDialog(report, self.ccdaemon, parent=self.window)
+ report_dialog = ReporterDialog(report, self.ccdaemon, log=self.updates, parent=self.window)
# (response, report)
response, result = report_dialog.run()
if response == gtk.RESPONSE_APPLY:
try:
- self.update_pBar = False
self.pBarWindow.show_all()
self.timer = gobject.timeout_add(100, self.progress_update_cb)
reporters_settings = {}
@@ -308,9 +302,9 @@ class MainWindow():
self.refresh_report(report)
def refresh_report(self, report):
- self.update_pBar = False
+ self.updates = ""
self.pBarWindow.show_all()
- self.timer = gobject.timeout_add (100,self.progress_update_cb)
+ self.timer = gobject.timeout_add(100, self.progress_update_cb)
# show the report window with selected report
try:
@@ -329,14 +323,14 @@ class MainWindow():
self.on_dumpRowActivated(self.dlist, None, path, None)
def on_dumpRowActivated(self, treeview, iter, path, user_data=None):
+ self.updates = ""
# FIXME don't duplicate the code, move to function
dumpsListStore, path = treeview.get_selection().get_selected_rows()
if not path:
return
- self.update_pBar = False
#self.pBar.show()
self.pBarWindow.show_all()
- self.timer = gobject.timeout_add (100,self.progress_update_cb)
+ self.timer = gobject.timeout_add(100, self.progress_update_cb)
dump = dumpsListStore.get_value(dumpsListStore.get_iter(path[0]), dumpsListStore.get_n_columns()-1)
# show the report window with selected dump
diff --git a/src/Gui/CCReporterDialog.py b/src/Gui/CCReporterDialog.py
index d943c0df..09a9c914 100644
--- a/src/Gui/CCReporterDialog.py
+++ b/src/Gui/CCReporterDialog.py
@@ -26,10 +26,11 @@ CD_ATT = "a"
# response
REFRESH = -50
+SHOW_LOG = -60
class ReporterDialog():
"""Reporter window"""
- def __init__(self, report, daemon, parent=None):
+ def __init__(self, report, daemon, log=None, parent=None):
self.editable = []
self.row_dict = {}
self.report = report
@@ -80,22 +81,29 @@ class ReporterDialog():
toggle_renderer.set_property('activatable', True)
toggle_renderer.connect( 'toggled', self.on_send_toggled, self.reportListStore )
column = gtk.TreeViewColumn('Send', toggle_renderer)
- column.add_attribute( toggle_renderer, "active", 3)
- column.add_attribute( toggle_renderer, "visible", 4)
+ column.add_attribute(toggle_renderer, "active", 3)
+ column.add_attribute(toggle_renderer, "visible", 4)
self.tvReport.insert_column(column,0)
# connect the signals
self.tvReport.connect_after("size-allocate", self.on_window_resize)
# start with the warning hidden, so it's not visible when there is no rating
self.wTree.get_widget("ebErrors").hide()
+ self.wTree.get_widget("bLog").connect("clicked", self.show_log_cb, log)
self.hydrate()
+ def show_log_cb(self, widget, log):
+ show_log(log, parent=self.window)
# this callback is called when user press Cancel or Report button in Report dialog
- def on_response(self, dialog, response_id, daemon ):
- # thu button has been pressed (probably)
+ def on_response(self, dialog, response_id, daemon):
+ # the button has been pressed (probably)
+ # print "response_id", response_id
if response_id == gtk.RESPONSE_APPLY:
if not (self.check_settings(daemon) and self.check_report()):
dialog.stop_emission("response")
self.wTree.get_widget("bSend").stop_emission("clicked")
+ if response_id == SHOW_LOG:
+ # prevent dialog from quitting the run()
+ dialog.stop_emission("response")
def on_send_toggled(self, cell, path, model):
model[path][3] = not model[path][3]
@@ -235,8 +243,6 @@ class ReporterDialog():
# probably usable 3
elif int(self.report[item][CD_CONTENT]) < 4:
ebErrors.show()
- fReproducer.hide()
- fComments.hide()
lErrors.set_markup(_("The backtrace is incomplete, please make sure you provide good steps to reproduce."))
bSend.set_sensitive(True)
else:
diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py
index 511e4bce..0532ab79 100644
--- a/src/Gui/CC_gui_functions.py
+++ b/src/Gui/CC_gui_functions.py
@@ -45,9 +45,12 @@ def gui_report_dialog ( report_status_dict, parent_dialog,
plugin_label = Label()
plugin_label.set_markup("<b>%s</b>: " % plugin)
plugin_label.set_justify(gtk.JUSTIFY_RIGHT)
+ plugin_label.set_alignment(0, 0)
status_label = Label()
status_label.set_max_width_chars(MAX_WIDTH)
status_label.set_selectable(True)
+ status_label.set_line_wrap(True)
+ status_label.set_alignment(0, 0)
status_hbox.pack_start(plugin_label, expand=False)
status_hbox.pack_start(status_label, expand=False)
# 0 means not succesfull
@@ -207,6 +210,26 @@ def get_icon_for_package(theme,package):
else:
return None
+def show_log(log, parent=None):
+ builder = gtk.Builder()
+ builderfile = "%s%sdialogs.glade" % (sys.path[0],"/")
+ builder.add_from_file(builderfile)
+ dialog = builder.get_object("LogViewer")
+ tevLog = builder.get_object("tevLog")
+
+ if parent:
+ dialog.set_position (gtk.WIN_POS_CENTER_ON_PARENT)
+ dialog.set_transient_for(parent)
+ else:
+ dialog.set_position (gtk.WIN_POS_CENTER)
+
+ buff = gtk.TextBuffer()
+ buff.set_text(log)
+ tevLog.set_buffer(buff)
+
+ dialog.run()
+ dialog.destroy()
+
if __name__ == "__main__":
window = gtk.Window()
gui_report_dialog("<b>Bugzilla</b>: <span foreground='red'>CReporterBugzilla::Report(): CReporterBugzilla::Login(): RPC response indicates failure. The username or password you entered is not valid.</span>\n<b>Logger</b>: Report was stored into: /var/log/abrt-logger", window)
diff --git a/src/Gui/Makefile.am b/src/Gui/Makefile.am
index 7f61bbce..60a7bfe3 100644
--- a/src/Gui/Makefile.am
+++ b/src/Gui/Makefile.am
@@ -2,7 +2,7 @@
bin_SCRIPTS = abrt-gui
-PYTHON_FILES = CCDBusBackend.py CCDumpList.py CCDump.py CC_gui_functions.py \
+PYTHON_FILES = CCDBusBackend.py CCDumpList.py CCDump.py CC_gui_functions.py \
CCReporterDialog.py CCReport.py abrt_utils.py \
CCMainWindow.py CellRenderers.py ABRTExceptions.py \
SettingsDialog.py ABRTPlugin.py PluginList.py PluginSettingsUI.py \
@@ -28,4 +28,5 @@ abrt.desktop:
install-exec-hook:
for b in $(bin_SCRIPTS); do \
sed 's:/usr/share:$(datadir):g' -i $(DESTDIR)$(bindir)/$$b || exit $$?; \
+ sed 's:VERSION:@VERSION@:g' -i $(DESTDIR)$(bindir)/$$b || exit $$?; \
done
diff --git a/src/Gui/abrt-gui b/src/Gui/abrt-gui
index 85bdebbc..78379be7 100755
--- a/src/Gui/abrt-gui
+++ b/src/Gui/abrt-gui
@@ -1,4 +1,8 @@
#!/bin/sh
+if test x"$1" = x"--help" || test x"$1" = x"--version"; then
+ echo "abrt-gui VERSION"
+ exit 0
+fi
export PYTHONPATH=/usr/share/abrt
export XLOGNAME=$LOGNAME
exec /usr/bin/python /usr/share/abrt/CCMainWindow.py "$@"
diff --git a/src/Gui/ccgui.glade b/src/Gui/ccgui.glade
index 04bc26b5..b12a631c 100644
--- a/src/Gui/ccgui.glade
+++ b/src/Gui/ccgui.glade
@@ -6,14 +6,14 @@
<property name="width_request">270</property>
<property name="border_width">12</property>
<property name="title" translatable="yes">Please wait..</property>
- <property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
- <property name="default_width">270</property>
+ <property name="default_width">470</property>
<property name="transient_for">main_window3</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<widget class="GtkLabel" id="lStatus">
@@ -35,6 +35,39 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkExpander" id="expander1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <widget class="GtkTextView" id="tvUpdates">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="lUpdates">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Details</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
@@ -246,12 +279,19 @@ Zdenek Prikryl &lt;zprikryl@redhat.com&gt;</property>
<property name="resize_mode">queue</property>
<property name="shadow_type">none</property>
<child>
- <widget class="GtkLabel" id="lReported">
+ <widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">Not Reported</property>
- <property name="selectable">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">6</property>
+ <child>
+ <widget class="GtkLabel" id="lReported">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Not Reported</property>
+ <property name="selectable">True</property>
+ </widget>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/Gui/dialogs.glade b/src/Gui/dialogs.glade
index b5e5273a..77e78ddc 100644
--- a/src/Gui/dialogs.glade
+++ b/src/Gui/dialogs.glade
@@ -74,4 +74,66 @@
<action-widget response="0">button1</action-widget>
</action-widgets>
</object>
+ <object class="GtkDialog" id="LogViewer">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Log</property>
+ <property name="modal">True</property>
+ <property name="default_width">450</property>
+ <property name="default_height">260</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView" id="tevLog">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area3">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="bClose">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">bClose</action-widget>
+ </action-widgets>
+ </object>
</interface>
diff --git a/src/Gui/report.glade b/src/Gui/report.glade
index 08777fb1..0eae1f16 100644
--- a/src/Gui/report.glade
+++ b/src/Gui/report.glade
@@ -55,7 +55,7 @@
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Following items will be send&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Following items will be sent&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
@@ -213,6 +213,20 @@
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
+ <widget class="GtkButton" id="bLog">
+ <property name="label" translatable="yes">Log</property>
+ <property name="response_id">-60</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkButton" id="bCancel">
<property name="label">gtk-cancel</property>
<property name="response_id">-6</property>
@@ -224,7 +238,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -239,7 +253,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -253,7 +267,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
diff --git a/src/Hooks/CCpp.cpp b/src/Hooks/CCpp.cpp
index ea616860..fdb31a5c 100644
--- a/src/Hooks/CCpp.cpp
+++ b/src/Hooks/CCpp.cpp
@@ -20,7 +20,7 @@
*/
/* Make all file ops "large" and make off_t 64-bit.
- * No need to use O_LORGEFILE anywhere
+ * No need to use O_LARGEFILE anywhere
*/
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
diff --git a/src/Hooks/Makefile.am b/src/Hooks/Makefile.am
index 21569570..75819719 100644
--- a/src/Hooks/Makefile.am
+++ b/src/Hooks/Makefile.am
@@ -1,5 +1,5 @@
-libexec_PROGRAMS = abrt-hook-ccpp
-bin_PROGRAMS = dumpoops abrt-pyhook-helper
+libexec_PROGRAMS = abrt-hook-ccpp abrt-hook-python
+bin_PROGRAMS = dumpoops
# CCpp
abrt_hook_ccpp_SOURCES = \
@@ -32,27 +32,22 @@ dumpoops_LDADD = \
../../lib/Utils/libABRTUtils.la \
../../lib/Utils/libABRTdUtils.la
-# abrt-pyhook-helper
-abrt_pyhook_helper_SOURCES = \
- abrt-pyhook-helper.cpp
-abrt_pyhook_helper_CPPFLAGS = \
+# abrt-hook-python
+abrt_hook_python_SOURCES = \
+ abrt-hook-python.cpp
+abrt_hook_python_CPPFLAGS = \
-I$(srcdir)/../../inc \
-I$(srcdir)/../../lib/Utils \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
-DCONF_DIR=\"$(CONF_DIR)\" \
-DVAR_RUN=\"$(VAR_RUN)\" \
-D_GNU_SOURCE
-abrt_pyhook_helper_LDADD = \
+abrt_hook_python_LDADD = \
../../lib/Utils/libABRTUtils.la
-man_MANS = pyhook.conf.5
-
python_PYTHON = sitecustomize.py abrt_exception_handler.py
EXTRA_DIST = abrt_exception_handler.py.in $(man_MANS)
-pyhookconfdir = $(CONF_DIR)
-dist_pyhookconf_DATA = pyhook.conf
-
CLEANFILES := $(notdir $(wildcard *~)) $(notdir $(wildcard *\#)) $(notdir $(wildcard \.\#*)) $(notdir $(wildcard *.pyc))
abrt_exception_handler.py:
diff --git a/src/Hooks/abrt-pyhook-helper.cpp b/src/Hooks/abrt-hook-python.cpp
index 0d15d78f..cd17e402 100644
--- a/src/Hooks/abrt-pyhook-helper.cpp
+++ b/src/Hooks/abrt-hook-python.cpp
@@ -1,5 +1,5 @@
/*
- abrt-pyhook-helper.cpp - writes data to the /var/cache/abrt directory
+ abrt-hook-python.cpp - writes data to the /var/cache/abrt directory
with SUID bit
Copyright (C) 2009 RedHat inc.
@@ -67,7 +67,7 @@ int main(int argc, char** argv)
default:
usage:
error_msg_and_die(
- "Usage: abrt-pyhook-helper [OPTIONS] <BACKTRACE\n"
+ "Usage: abrt-hook-python [OPTIONS] <BACKTRACE\n"
"\nOptions:\n"
" -p,--pid PID PID of process that caused the crash\n"
" -p,--executable PATH absolute path to the program that crashed\n"
diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in
index c7f72530..b5ec35f3 100644
--- a/src/Hooks/abrt_exception_handler.py.in
+++ b/src/Hooks/abrt_exception_handler.py.in
@@ -107,7 +107,7 @@ def write_dump(pid, tb_uuid, tb):
if sys.argv[0]:
executable = os.path.abspath(sys.argv[0])
- command = ["abrt-pyhook-helper"]
+ command = ["/usr/libexec/abrt-hook-python"]
command.append("--pid=%s" % pid)
command.append("--executable=%s" % executable)
command.append("--uuid=%s" % tb_uuid)
@@ -129,14 +129,10 @@ def __dump_exception(out, text, tracebk):
out.write ("\nLocal variables in innermost frame:\n")
try:
for (key, value) in frame.f_locals.items():
- out.write ("%s: %s\n" % (key, value))
+ out.write ("%s: %s\n" % (key, repr(value)))
except:
pass
-
-def __exception_window(title, text, component_name):
- pass
-
__ACTION_STR = ""
def action(what):
"""Describe what you want to do actually.
diff --git a/src/Hooks/pyhook.conf b/src/Hooks/pyhook.conf
deleted file mode 100644
index 731debbd..00000000
--- a/src/Hooks/pyhook.conf
+++ /dev/null
@@ -1 +0,0 @@
-enabled = yes
diff --git a/src/Hooks/pyhook.conf.5 b/src/Hooks/pyhook.conf.5
deleted file mode 100644
index d9d8bbb0..00000000
--- a/src/Hooks/pyhook.conf.5
+++ /dev/null
@@ -1,16 +0,0 @@
-.TH "pyhook.conf" "5" "1 Oct 2009" ""
-.SH NAME
-pyhook.conf \- configuration file for abrt
-.SH DESCRIPTION
-.P
-This configuration file controls whether python crash handler is enabled.
-It has this format:
-.TP
-.B enabled = \fIyes\fP | \fIno\fP
-When set to "yes", crashing python programs will generate a crash report
-for abrt. If not, they will not do that.
-.SH "SEE ALSO"
-.IR abrt (8),
-.IR abrt-plugins (7)
-.SH AUTHOR
-Written by Jiří Moskovčák <jmoskovc@redhat.com>.
diff --git a/src/Hooks/sitecustomize.py b/src/Hooks/sitecustomize.py
index 71d8c4e1..8027726b 100644
--- a/src/Hooks/sitecustomize.py
+++ b/src/Hooks/sitecustomize.py
@@ -5,38 +5,41 @@
# and python interpreter runs it automatically everytime
# some python script is executed.
-config = None
-conf = {}
-try:
- config = open("/etc/abrt/pyhook.conf","r")
-except:
- # Silently ignore if file doesn't exist.
- pass
+def abrt_daemon_ok():
+ try:
+ #FIXME: make it relocable! this will work only when installed in default path
+ #pidfile = open(VAR_RUN_PID_FILE, "r");
+ pidfile = open("/var/run/abrt.pid", "r")
+ except Exception, ex:
+ # log the exception?
+ return False
-try:
- if config:
- # we expect config in form
- # key = value
- # Enabled = yes
- # this should strip
- line = config.readline().lower().replace(' ','').strip('\n').split('=')
- conf[line[0]] = line[1]
- config.close()
-except:
- # Ignore silently everything, because we don't want to bother user
- # if this hook doesn't work.
- pass
+ pid = pidfile.readline()
+ pidfile.close()
+ if not pid:
+ return False
+
+ try:
+ # pid[:-1] strips the trailing '\n'
+ cmdline = open("/proc/%s/cmdline" % pid[:-1], "r").readline()
+ except Exception, ex:
+ # can't read cmdline
+ return False
+ if not ("abrtd" in cmdline):
+ return False
-if conf.has_key("enabled"):
+ return True
+
+if abrt_daemon_ok():
# Prevent abrt exception handler from running when the abrtd daemon is
# not active.
- # abrtd sets the value to "no" when deactivated and vice versa.
- if conf["enabled"] == "yes":
- try:
- from abrt_exception_handler import *
+ try:
+ from abrt_exception_handler import installExceptionHandler
- installExceptionHandler(debug = 1)
- except Exception, e:
- # FIXME don't print anything, write it to some log file
- print e
- pass
+ installExceptionHandler(debug = 1)
+ except Exception, e:
+ # FIXME: log errors?
+ pass
+else:
+ #FIXME: log something?
+ pass