summaryrefslogtreecommitdiffstats
path: root/src/Hooks
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2010-02-15 18:09:55 +0100
committerNikola Pajkovsky <npajkovs@redhat.com>2010-02-15 18:09:55 +0100
commitd93fc21129f08a149d7a1bb042179942485fcedb (patch)
tree72ec4eb636b15d8e2385f068881f86a6aa88db2b /src/Hooks
parentdeef343e0372b0a167f1d35f9ef9d18694aa9a0e (diff)
parent3a0729e697b24d4d30e3a1a008f83ca605aaad5d (diff)
downloadabrt-d93fc21129f08a149d7a1bb042179942485fcedb.tar.gz
abrt-d93fc21129f08a149d7a1bb042179942485fcedb.tar.xz
abrt-d93fc21129f08a149d7a1bb042179942485fcedb.zip
Merge branch 'master' into bugzilla
Diffstat (limited to 'src/Hooks')
-rw-r--r--src/Hooks/abrt-hook-ccpp.cpp60
-rw-r--r--src/Hooks/abrt-hook-python.cpp15
-rw-r--r--src/Hooks/abrt_exception_handler.py.in14
3 files changed, 47 insertions, 42 deletions
diff --git a/src/Hooks/abrt-hook-ccpp.cpp b/src/Hooks/abrt-hook-ccpp.cpp
index 9d1dc19..d21b8e6 100644
--- a/src/Hooks/abrt-hook-ccpp.cpp
+++ b/src/Hooks/abrt-hook-ccpp.cpp
@@ -82,31 +82,52 @@ int main(int argc, char** argv)
/* set to max possible >0 value */
ulimit_c = ~((off_t)1 << (sizeof(off_t)*8-1));
}
- off_t core_size = 0;
-
if (errno || pid <= 0)
{
error_msg_and_die("pid '%s' or limit '%s' is bogus", argv[2], argv[5]);
}
+ char* executable = get_executable(pid);
+ if (executable == NULL)
+ {
+ error_msg_and_die("can't read /proc/%lu/exe link", (long)pid);
+ }
+ if (strstr(executable, "/abrt-hook-ccpp"))
+ {
+ error_msg_and_die("pid %lu is '%s', not dumping it to avoid recursion",
+ (long)pid, executable);
+ }
+
+ char *user_pwd = get_cwd(pid); /* may be NULL on error */
+
+ /* Parse abrt.conf and plugins/CCpp.conf */
+ unsigned setting_MaxCrashReportsSize = 0;
+ bool setting_MakeCompatCore = false;
+ parse_conf(CONF_DIR"/plugins/CCpp.conf", &setting_MaxCrashReportsSize, &setting_MakeCompatCore);
+
+ int core_fd = STDIN_FILENO;
+ off_t core_size = 0;
+
const char *signame = NULL;
/* Tried to use array for this but C++ does not support v[] = { [IDX] = "str" } */
switch (signal_no)
{
- case SIGQUIT: signame = "QUIT"; break;
case SIGILL : signame = "ILL" ; break;
- case SIGABRT: signame = "ABRT"; break;
case SIGFPE : signame = "FPE" ; break;
case SIGSEGV: signame = "SEGV"; break;
+ case SIGBUS : signame = "BUS" ; break; //Bus error (bad memory access)
+ case SIGABRT: signame = "ABRT"; break; //usually when abort() was called
+ //case SIGQUIT: signame = "QUIT"; break; //Quit from keyboard
+ //case SIGSYS : signame = "SYS" ; break; //Bad argument to routine (SVr4)
+ //case SIGTRAP: signame = "TRAP"; break; //Trace/breakpoint trap
+ //case SIGXCPU: signame = "XCPU"; break; //CPU time limit exceeded (4.2BSD)
+ //case SIGXFSZ: signame = "XFSZ"; break; //File size limit exceeded (4.2BSD)
}
if (signame == NULL) {
- /* not a signal we care about, exit silently */
- return 0;
+ /* not a signal we care about */
+ goto create_user_core;
}
- char *user_pwd = get_cwd(pid); /* may be NULL on error */
- int core_fd = STDIN_FILENO;
-
if (!daemon_is_ok())
{
/* not an error, exit with exitcode 0 */
@@ -119,22 +140,6 @@ int main(int argc, char** argv)
try
{
- char* executable = get_executable(pid);
- if (executable == NULL)
- {
- error_msg_and_die("can't read /proc/%lu/exe link", (long)pid);
- }
- if (strstr(executable, "/abrt-hook-ccpp"))
- {
- error_msg_and_die("pid %lu is '%s', not dumping it to avoid recursion",
- (long)pid, executable);
- }
-
- /* Parse abrt.conf and plugins/CCpp.conf */
- unsigned setting_MaxCrashReportsSize = 0;
- bool setting_MakeCompatCore = false;
- parse_conf(CONF_DIR"/plugins/CCpp.conf", &setting_MaxCrashReportsSize, &setting_MakeCompatCore);
-
if (setting_MaxCrashReportsSize > 0)
{
check_free_space(setting_MaxCrashReportsSize);
@@ -267,8 +272,6 @@ int main(int argc, char** argv)
trim_debug_dumps(setting_MaxCrashReportsSize, path);
}
- if (!setting_MakeCompatCore)
- return 0;
/* fall through to creating user core */
}
catch (CABRTException& e)
@@ -282,6 +285,9 @@ int main(int argc, char** argv)
create_user_core:
+ if (!setting_MakeCompatCore)
+ return 0;
+
/* note: core_size may be == 0 ("unknown") */
if (core_size > ulimit_c || ulimit_c == 0)
return 0;
diff --git a/src/Hooks/abrt-hook-python.cpp b/src/Hooks/abrt-hook-python.cpp
index 356174f..3445954 100644
--- a/src/Hooks/abrt-hook-python.cpp
+++ b/src/Hooks/abrt-hook-python.cpp
@@ -37,21 +37,6 @@
static char *pid;
static char *executable;
-// Note: "" will return false
-static bool isxdigit_str(const char *str)
-{
- do {
- if ((*str < '0' || *str > '9') // not a digit
- && ((*str | 0x20) < 'a' || (*str | 0x20) > 'f') // not A-F or a-f
- )
- {
- return false;
- }
- str++;
- } while (*str);
- return true;
-}
-
static bool printable_str(const char *str)
{
do {
diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in
index 89f3013..b5e15b8 100644
--- a/src/Hooks/abrt_exception_handler.py.in
+++ b/src/Hooks/abrt_exception_handler.py.in
@@ -59,8 +59,22 @@ def handleMyException((etype, value, tb)):
return sys.__excepthook__(etype, value, tb)
try:
+ import os
import os.path
import traceback
+ import errno
+
+ # EPIPE is not a crash, it happens all the time
+ # Testcase: script.py | true, where script.py is:
+ ## #!/usr/bin/python
+ ## import os
+ ## import time
+ ## time.sleep(1)
+ ## os.write(1, "Hello\n") # print "Hello" wouldn't be the same
+ #
+ if etype == IOError or etype == OSError:
+ if value.errno == errno.EPIPE:
+ return sys.__excepthook__(etype, value, tb)
# "-c" appears in this case:
# $ python -c 'import sys; print "argv0 is:%s" % sys.argv[0]'