diff options
author | Karel Klic <kklic@redhat.com> | 2009-11-24 15:06:43 +0100 |
---|---|---|
committer | Karel Klic <kklic@redhat.com> | 2009-11-24 15:06:43 +0100 |
commit | a2a69a438e47d361f3c58fe8d631df906e2120d1 (patch) | |
tree | 219fbdd4a115b46925a80e0482c24faaad1f2da2 | |
parent | f6e929ee12a08a95c263b9c4c3e89f6eab188c4c (diff) | |
parent | bc5dfcff0c2eedd84a5f2bec27c519e2e90c5969 (diff) | |
download | abrt-a2a69a438e47d361f3c58fe8d631df906e2120d1.tar.gz abrt-a2a69a438e47d361f3c58fe8d631df906e2120d1.tar.xz abrt-a2a69a438e47d361f3c58fe8d631df906e2120d1.zip |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
-rw-r--r-- | abrt.spec | 57 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | examples/not_oops1.test (renamed from examples/not_oops1) | 0 | ||||
-rw-r--r-- | examples/not_oops2.test (renamed from examples/not_oops2) | 0 | ||||
-rw-r--r-- | examples/oops1.test (renamed from examples/oops1) | 0 | ||||
-rw-r--r-- | examples/oops3.right | 6 | ||||
-rw-r--r-- | examples/oops3.test (renamed from examples/oops3) | 0 | ||||
-rwxr-xr-x | examples/test.sh | 4 | ||||
-rw-r--r-- | lib/Plugins/CCpp.cpp | 9 | ||||
-rw-r--r-- | lib/Plugins/Kerneloops.conf | 11 | ||||
-rw-r--r-- | lib/Plugins/KerneloopsReporter.conf | 5 | ||||
-rw-r--r-- | lib/Plugins/KerneloopsScanner.conf | 4 | ||||
-rw-r--r-- | lib/Plugins/KerneloopsSysLog.cpp | 160 | ||||
-rw-r--r-- | lib/Plugins/Makefile.am | 2 | ||||
-rw-r--r-- | lib/Plugins/SQLite3.cpp | 4 | ||||
-rw-r--r-- | lib/Utils/make_descr.cpp | 2 | ||||
-rw-r--r-- | src/Daemon/PluginManager.cpp | 14 | ||||
-rw-r--r-- | src/Gui/CCMainWindow.py | 10 | ||||
-rw-r--r-- | src/Gui/CC_gui_functions.py | 4 | ||||
-rw-r--r-- | src/Hooks/CCpp.cpp | 148 |
20 files changed, 267 insertions, 175 deletions
@@ -3,7 +3,7 @@ %{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} Summary: Automatic bug detection and reporting tool Name: abrt -Version: 0.0.11 +Version: 1.0.0 Release: 1%{?dist} License: GPLv2+ Group: Applications/System @@ -28,7 +28,7 @@ BuildRequires: libzip-devel, libtar-devel, bzip2-devel, zlib-devel BuildRequires: intltool BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: %{name}-libs = %{version}-%{release} -Prereq: /usr/sbin/groupadd +Requires(pre): /usr/sbin/groupadd %description %{name} is a tool to help users to detect defects in applications and @@ -95,22 +95,14 @@ analyzer plugin. %package addon-kerneloops Summary: %{name}'s kerneloops addon Group: System Environment/Libraries -Requires: %{name}-plugin-kerneloopsreporter = %{version}-%{release} +Requires: curl Requires: %{name} = %{version}-%{release} Obsoletes: kerneloops Obsoletes: abrt-plugin-kerneloops %description addon-kerneloops -This package contains plugins for kernel crashes information collecting. - -%package plugin-kerneloopsreporter -Summary: %{name}'s kerneloops reporter plugin -Group: System Environment/Libraries -Requires: curl -Requires: %{name} = %{version}-%{release} - -%description plugin-kerneloopsreporter -This package contains reporter plugin, that sends, collected by %{name}'s kerneloops +This package contains plugins for kernel crashes information collecting and + reporter plugin, that sends, collected by %{name}'s kerneloops addon, information about kernel crashes to specified server, e.g. kerneloops.org. %package plugin-sqlite3 @@ -212,7 +204,7 @@ Summary: Virtual package to install all necessary packages for usage from deskto Group: User Interface/Desktops Requires: %{name} = %{version}-%{release} Requires: %{name}-plugin-sqlite3, %{name}-plugin-bugzilla, %{name}-plugin-logger -# FIXME: upgrade workaround +#workaround for broken upgrade, remove! #Requires: %{name}-gui Requires: %{name}-addon-kerneloops Requires: %{name}-addon-ccpp, %{name}-addon-python @@ -331,15 +323,10 @@ fi %files addon-kerneloops %defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/%{name}/plugins/Kerneloops.conf -%config(noreplace) %{_sysconfdir}/%{name}/plugins/KerneloopsScanner.conf %{_bindir}/dumpoops %{_libdir}/%{name}/libKerneloops.so* %{_libdir}/%{name}/libKerneloopsScanner.so* %{_mandir}/man7/%{name}-KerneloopsScanner.7.gz - -%files plugin-kerneloopsreporter -%defattr(-,root,root,-) -%config(noreplace) %{_sysconfdir}/%{name}/plugins/KerneloopsReporter.conf %{_libdir}/%{name}/libKerneloopsReporter.so* %{_libdir}/%{name}/KerneloopsReporter.GTKBuilder %{_mandir}/man7/%{name}-KerneloopsReporter.7.gz @@ -418,6 +405,38 @@ fi %defattr(-,root,root,-) %changelog +* Fri Nov 20 2009 Jiri Moskovcak <jmoskovc@redhat.com> 1.0.0-1 +- new version +- comment input wraps words rhbz#531276 +- fixed hiding password dialog rhbz#529583 +- easier kerneloops reporting rhbz#528395 +- made menu entry translatable rhbz#536878 (jmoskovc@redhat.com) +- GUI: don't read the g-k every time we want to use the setting (jmoskovc@redhat.com) +- GUI: survive if g-k access is denied rhbz#534171 (jmoskovc@redhat.com) +- include more info into oops (we were losing the stack dump) (vda.linux@googlemail.com) +- make BZ insert small text attachments inline; move text file detection code (vda.linux@googlemail.com) +- GUI: fixed text wrapping in comment field rhbz#531276 (jmoskovc@redhat.com) +- GUI: added cancel to send dialog rhbz#537238 (jmoskovc@redhat.com) +- include abrt version in bug descriptions (vda.linux@googlemail.com) +- ccpp hook: implemented ReadonlyLocalDebugInfoDirs directive (vda.linux@googlemail.com) +- GUI: added window icon rhbz#537240 (jmoskovc@redhat.com) +- add support for \" escaping in config file (vda.linux@googlemail.com) +- add experimental saving of /var/log/Xorg*.log for X crashes (vda.linux@googlemail.com) +- APPLET: changed icon from default gtk-warning to abrt specific, add animation (jmoskovc@redhat.com) +- don't show icon on abrtd start/stop rhbz#537630 (jmoskovc@redhat.com) +- /var/cache/abrt permissions 1775 -> 0775 in spec file (kklic@redhat.com) +- Daemon properly checks /var/cache/abrt attributes (kklic@redhat.com) +- abrt user group; used by abrt-pyhook-helper (kklic@redhat.com) +- pyhook-helper: uid taken from system instead of command line (kklic@redhat.com) +- KerneloopsSysLog: fix breakage in code which detects abrt marker (vda.linux@googlemail.com) +- GUI: added support for backtrace rating (jmoskovc@redhat.com) +- InformAllUsers support. enabled by default for Kerneloops. Tested wuth CCpp. (vda.linux@googlemail.com) +- abrtd: call res_init() if /etc/resolv.conf or friends were changed rhbz#533589 (vda.linux@googlemail.com) +- supress errors in python hook to not colide with the running script (jmoskovc@redhat.com) + +* Tue Nov 10 2009 Jiri Moskovcak <jmoskovc@redhat.com> 0.0.11-2 +- spec file fixes + * Mon Nov 2 2009 Jiri Moskovcak <jmoskovc@redhat.com> 0.0.11-1 - re-enabled kerneloops - abrt-debuginfo-install: download packages one-by-one - better logging (vda.linux@googlemail.com) diff --git a/configure.ac b/configure.ac index 9123699d..8a0ab718 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([abrt], [0.0.11], [jmoskovc@redhat.com]) +AC_INIT([abrt], [1.0.0], [crash-catcher@fedorahosted.org]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) diff --git a/examples/not_oops1 b/examples/not_oops1.test index 63dba803..63dba803 100644 --- a/examples/not_oops1 +++ b/examples/not_oops1.test diff --git a/examples/not_oops2 b/examples/not_oops2.test index 5293fc1f..5293fc1f 100644 --- a/examples/not_oops2 +++ b/examples/not_oops2.test diff --git a/examples/oops1 b/examples/oops1.test index e4f02d26..e4f02d26 100644 --- a/examples/oops1 +++ b/examples/oops1.test diff --git a/examples/oops3.right b/examples/oops3.right index a7711674..bbc39b79 100644 --- a/examples/oops3.right +++ b/examples/oops3.right @@ -51,6 +51,8 @@ Call Trace: [<ffffffff810116a9>] do_notify_resume+0x2a/0x7c [<ffffffff81011fc1>] int_signal+0x12/0x17 Code: 1f 44 00 00 f6 87 0e 04 00 00 08 48 8b 87 10 01 00 00 74 0a 89 f6 48 03 70 18 8b 06 eb 0f c1 ee 02 89 f6 48 c1 e6 02 48 03 70 18 <8b> 06 c9 c3 55 48 89 e5 0f 1f 44 00 00 83 7f 74 00 74 09 31 f6 +RIP [<ffffffffa006c13c>] radeon_read_ring_rptr+0x30/0x34 [radeon] +RSP <ffff88007a7c5ad0> Version: 2.6.32-0.51.rc7.git2.fc13.x86_64 general protection fault: 0000 [#1] SMP @@ -103,6 +105,8 @@ Call Trace: [<ffffffff810116a9>] do_notify_resume+0x2a/0x7c [<ffffffff81011fc1>] int_signal+0x12/0x17 Code: 1f 44 00 00 f6 87 0e 04 00 00 08 48 8b 87 10 01 00 00 74 0a 89 f6 48 03 70 18 8b 06 eb 0f c1 ee 02 89 f6 48 c1 e6 02 48 03 70 18 <8b> 06 c9 c3 55 48 89 e5 0f 1f 44 00 00 83 7f 74 00 74 09 31 f6 +RIP [<ffffffffa006c13c>] radeon_read_ring_rptr+0x30/0x34 [radeon] +RSP <ffff88007a3d9ad0> Version: 2.6.32-0.51.rc7.git2.fc13.x86_64 general protection fault: 0000 [#1] SMP @@ -155,3 +159,5 @@ Call Trace: [<ffffffff810116a9>] do_notify_resume+0x2a/0x7c [<ffffffff81011fc1>] int_signal+0x12/0x17 Code: 1f 44 00 00 f6 87 0e 04 00 00 08 48 8b 87 10 01 00 00 74 0a 89 f6 48 03 70 18 8b 06 eb 0f c1 ee 02 89 f6 48 c1 e6 02 48 03 70 18 <8b> 06 c9 c3 55 48 89 e5 0f 1f 44 00 00 83 7f 74 00 74 09 31 f6 +RIP [<ffffffffa006c13c>] radeon_read_ring_rptr+0x30/0x34 [radeon] +RSP <ffff88007a3b3ad0> diff --git a/examples/oops3 b/examples/oops3.test index 570b10ee..570b10ee 100644 --- a/examples/oops3 +++ b/examples/oops3.test diff --git a/examples/test.sh b/examples/test.sh new file mode 100755 index 00000000..64b08ed8 --- /dev/null +++ b/examples/test.sh @@ -0,0 +1,4 @@ +for f in *.test; do + b="${f%%.test}" + dumpoops -s "$f" >"$b".right 2>&1 +done diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 83b0e9a3..d83d9b5a 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -99,10 +99,11 @@ static pid_t ExecVP(char** pArgs, uid_t uid, string& pOutput) int pipeout[2]; pid_t child; + gid_t gid = uid; struct passwd* pw = getpwuid(uid); - if (!pw) + if (pw) { - throw CABRTException(EXCEP_PLUGIN, string(__func__) + ": cannot get GID for UID."); + gid = pw->pw_gid; } xpipe(pipeout); @@ -124,8 +125,8 @@ static pid_t ExecVP(char** pArgs, uid_t uid, string& pOutput) /* Not a good idea, we won't see any error messages */ /* close(STDERR_FILENO); */ - setgroups(1, &pw->pw_gid); - setregid(pw->pw_gid, pw->pw_gid); + setgroups(1, &gid); + setregid(gid, gid); setreuid(uid, uid); setsid(); diff --git a/lib/Plugins/Kerneloops.conf b/lib/Plugins/Kerneloops.conf index 47b242ff..08dacd00 100644 --- a/lib/Plugins/Kerneloops.conf +++ b/lib/Plugins/Kerneloops.conf @@ -1,2 +1,13 @@ # compatibility with kerneloops.org tool InformAllUsers = yes + +# KerneloopsReporter configuration. Reports kernel crashes collected by the addon. +################################################################################ + +# kerneloops.org +SubmitURL = http://submit.kerneloops.org/submitoops.php + +# Kerneloops Scanner configuration. +################################################################################ + +SysLogFile = /var/log/messages diff --git a/lib/Plugins/KerneloopsReporter.conf b/lib/Plugins/KerneloopsReporter.conf deleted file mode 100644 index 5ec844a3..00000000 --- a/lib/Plugins/KerneloopsReporter.conf +++ /dev/null @@ -1,5 +0,0 @@ -# KerneloopsReporter configuration. Reports kernel crashes collected by the addon. -################################################################################ - -# kerneloops.org -SubmitURL = http://submit.kerneloops.org/submitoops.php diff --git a/lib/Plugins/KerneloopsScanner.conf b/lib/Plugins/KerneloopsScanner.conf deleted file mode 100644 index 36aac096..00000000 --- a/lib/Plugins/KerneloopsScanner.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Kerneloops Scanner configuration. -################################################################################ - -SysLogFile = /var/log/messages diff --git a/lib/Plugins/KerneloopsSysLog.cpp b/lib/Plugins/KerneloopsSysLog.cpp index 4e32f040..fdb4a029 100644 --- a/lib/Plugins/KerneloopsSysLog.cpp +++ b/lib/Plugins/KerneloopsSysLog.cpp @@ -41,11 +41,11 @@ static int extract_version(const char *linepointer, char *version) int ret; ret = 0; - if ((strstr(linepointer, "Pid") != NULL) - || (strstr(linepointer, "comm") != NULL) - || (strstr(linepointer, "CPU") != NULL) - || (strstr(linepointer, "REGS") != NULL) - || (strstr(linepointer, "EFLAGS") != NULL) + if (strstr(linepointer, "Pid") + || strstr(linepointer, "comm") + || strstr(linepointer, "CPU") + || strstr(linepointer, "REGS") + || strstr(linepointer, "EFLAGS") ) { char* start; char* end; @@ -71,6 +71,42 @@ struct line_info { char *ptr; char level; }; +static int record_oops(vector_string_t &oopses, struct line_info* lines_info, int oopsstart, int oopsend) +{ + int q; + int len; + int is_version; + char *oops; + char *version; + + len = 2; + for (q = oopsstart; q <= oopsend; q++) + len += strlen(lines_info[q].ptr) + 1; + + oops = (char*)xzalloc(len); + version = (char*)xzalloc(len); + + is_version = 0; + for (q = oopsstart; q <= oopsend; q++) { + if (!is_version) + is_version = extract_version(lines_info[q].ptr, version); + if (lines_info[q].ptr[0]) { + strcat(oops, lines_info[q].ptr); + strcat(oops, "\n"); + } + } + int rv = 1; + /* too short oopses are invalid */ + if (strlen(oops) > 100) { + queue_oops(oopses, oops, version); + } else { + VERB3 log("Dropped oops: too short"); + rv = 0; + } + free(oops); + free(version); + return rv; +} #define REALLOC_CHUNK 1000 int extract_oopses(vector_string_t &oopses, char *buffer, size_t buflen) { @@ -172,12 +208,15 @@ next_line: i = 0; while (i < linecount) { - char *const curline = lines_info[i].ptr; + char *curline = lines_info[i].ptr; if (curline == NULL) { i++; continue; } + while (*curline == ' ') + curline++; + if (oopsstart < 0) { /* find start-of-oops markers */ if (strstr(curline, "general protection fault:")) @@ -245,7 +284,7 @@ next_line: inbacktrace = 1; else if (strnlen(curline, 9) > 8 - && curline[0] == ' ' && curline[1] == '[' && curline[2] == '<' + && curline[0] == '[' && curline[1] == '<' && strstr(curline, ">]") && strstr(curline, "+0x") && strstr(curline, "/0x") @@ -258,20 +297,19 @@ next_line: else if (oopsstart >= 0 && inbacktrace) { int oopsend = INT_MAX; - /* The Code: line means we're done with the backtrace */ - if (strstr(curline, "Code:") != NULL) - oopsend = i; /* line needs to start with " [" or have "] [" if it is still a call trace */ /* example: "[<ffffffffa006c156>] radeon_get_ring_head+0x16/0x41 [radeon]" */ - else if ((curline[0] != ' ' || curline[1] != '[') - && curline[0] != '[' /* in syslog format, leading space is lost */ - && strstr(curline, "] [") == NULL - && strstr(curline, "--- Exception") == NULL - && strstr(curline, " LR =") == NULL - && strstr(curline, "<#DF>") == NULL - && strstr(curline, "<IRQ>") == NULL - && strstr(curline, "<EOI>") == NULL - && strstr(curline, "<<EOE>>") == NULL + if (curline[0] != '[' + && !strstr(curline, "] [") + && !strstr(curline, "--- Exception") + && !strstr(curline, "LR =") + && !strstr(curline, "<#DF>") + && !strstr(curline, "<IRQ>") + && !strstr(curline, "<EOI>") + && !strstr(curline, "<<EOE>>") + && strncmp(curline, "Code: ", 6) != 0 + && strncmp(curline, "RIP ", 4) != 0 + && strncmp(curline, "RSP ", 4) != 0 ) { oopsend = i-1; /* not a call trace line */ } @@ -281,53 +319,23 @@ next_line: /* single oopses are of the same loglevel */ else if (lines_info[i].level != prevlevel) oopsend = i-1; - else if (strstr(curline, "Instruction dump::") != NULL) /* why "::"? is it a typo? */ + else if (strstr(curline, "Instruction dump::")) /* why "::"? is it a typo? */ oopsend = i; /* if a new oops starts, this one has ended */ - else if (strstr(curline, "WARNING:") != NULL && oopsstart != i) + else if (strstr(curline, "WARNING:") && oopsstart != i) oopsend = i-1; - else if (strstr(curline, "Unable to handle") != NULL && oopsstart != i) + else if (strstr(curline, "Unable to handle") && oopsstart != i) + oopsend = i-1; + /* kernel end-of-oops marker (not including marker itself) */ + else if (strstr(curline, "---[ end trace")) oopsend = i-1; - /* kernel end-of-oops marker */ - else if (strstr(curline, "---[ end trace") != NULL) - oopsend = i; if (oopsend <= i) { - int q; - int len; - int is_version; - char *oops; - char *version; - VERB3 log("End of oops at line %d (%d): '%s'", oopsend, i, lines_info[oopsend].ptr); - - len = 2; - for (q = oopsstart; q <= oopsend; q++) - len += strlen(lines_info[q].ptr) + 1; - - oops = (char*)xzalloc(len); - version = (char*)xzalloc(len); - - is_version = 0; - for (q = oopsstart; q <= oopsend; q++) { - if (!is_version) - is_version = extract_version(lines_info[q].ptr, version); - if (lines_info[q].ptr[0]) { - strcat(oops, lines_info[q].ptr); - strcat(oops, "\n"); - } - } - /* too short oopses are invalid */ - if (strlen(oops) > 100) { - queue_oops(oopses, oops, version); + if (record_oops(oopses, lines_info, oopsstart, oopsend)) oopsesfound++; - } else { - VERB3 log("Dropped oops: too short"); - } oopsstart = -1; inbacktrace = 0; - free(oops); - free(version); } } @@ -336,13 +344,13 @@ next_line: if (oopsstart >= 0) { /* Do we have a suspiciously long oops? Cancel it */ - if (i-oopsstart > 50) { + if (i-oopsstart > 60) { inbacktrace = 0; oopsstart = -1; VERB3 log("Dropped oops, too long"); continue; } - if (!inbacktrace && i-oopsstart > 30) { + if (!inbacktrace && i-oopsstart > 40) { /*inbacktrace = 0; - already is */ oopsstart = -1; VERB3 log("Dropped oops, too long"); @@ -352,43 +360,11 @@ next_line: } /* while (i < linecount) */ /* process last oops if we have one */ -// TODO: do not duplicate code - if (oopsstart >= 0) { - int q; - int len; - int is_version; - char *oops; - char *version; - + if (oopsstart >= 0) { int oopsend = i-1; - VERB3 log("End of oops at line %d (end of file): '%s'", oopsend, lines_info[oopsend].ptr); - - len = 2; - while (oopsend > 0 && lines_info[oopsend].ptr == NULL) - oopsend--; - for (q = oopsstart; q <= oopsend; q++) - len += strlen(lines_info[q].ptr) + 1; - - oops = (char*)xzalloc(len); - version = (char*)xzalloc(len); - - is_version = 0; - for (q = oopsstart; q <= oopsend; q++) { - if (!is_version) - is_version = extract_version(lines_info[q].ptr, version); - strcat(oops, lines_info[q].ptr); - strcat(oops, "\n"); - } - /* too short oopses are invalid */ - if (strlen(oops) > 100) { - queue_oops(oopses, oops, version); + if (record_oops(oopses, lines_info, oopsstart, oopsend)) oopsesfound++; - } else { - VERB3 log("Dropped oops: too short"); - } - free(oops); - free(version); } free(lines_info); diff --git a/lib/Plugins/Makefile.am b/lib/Plugins/Makefile.am index 9d80d91f..97da2204 100644 --- a/lib/Plugins/Makefile.am +++ b/lib/Plugins/Makefile.am @@ -29,8 +29,6 @@ dist_pluginsconf_DATA = \ SQLite3.conf \ Logger.conf \ Kerneloops.conf \ - KerneloopsScanner.conf \ - KerneloopsReporter.conf \ Bugzilla.conf \ Catcut.conf \ TicketUploader.conf \ diff --git a/lib/Plugins/SQLite3.cpp b/lib/Plugins/SQLite3.cpp index cc639da3..4aac98de 100644 --- a/lib/Plugins/SQLite3.cpp +++ b/lib/Plugins/SQLite3.cpp @@ -314,8 +314,8 @@ void CSQLite3::Delete(const std::string& pUUID, const std::string& pUID) { Exec("DELETE FROM "ABRT_TABLE" " "WHERE "DATABASE_COLUMN_UUID" = '"+pUUID+"' " - "AND "DATABASE_COLUMN_UID" = '"+pUID+"' " - "OR "DATABASE_COLUMN_UID" = '-1';"); + "AND ("DATABASE_COLUMN_UID" = '"+pUID+"' " + "OR "DATABASE_COLUMN_UID" = '-1');"); } else { diff --git a/lib/Utils/make_descr.cpp b/lib/Utils/make_descr.cpp index c4cc3f35..7f60c90f 100644 --- a/lib/Utils/make_descr.cpp +++ b/lib/Utils/make_descr.cpp @@ -52,7 +52,7 @@ static void add_content(bool &was_multiline, string& description, const char *he } /* Text attachments smaller than this will be also included in descrition */ -#define INLINE_TEXT_ATT_SIZE 1024 +#define INLINE_TEXT_ATT_SIZE (2*1024) string make_description_bz(const map_crash_report_t& pCrashReport) { diff --git a/src/Daemon/PluginManager.cpp b/src/Daemon/PluginManager.cpp index 2f4d8750..a75b48ba 100644 --- a/src/Daemon/PluginManager.cpp +++ b/src/Daemon/PluginManager.cpp @@ -205,7 +205,19 @@ void CPluginManager::RegisterPlugin(const char *pName) CPlugin* plugin = abrt_plugin->second->PluginNew(); map_plugin_settings_t pluginSettings; - LoadPluginSettings(ssprintf(PLUGINS_CONF_DIR"/%s."PLUGINS_CONF_EXTENSION, pName).c_str(), pluginSettings); + if ((strcmp(pName, "Kerneloops") == 0) + || (strcmp(pName, "KerneloopsReporter") == 0) + || (strcmp(pName, "KerneloopsScanner") == 0) + ) + { + LoadPluginSettings(PLUGINS_CONF_DIR"/Kerneloops."PLUGINS_CONF_EXTENSION, pluginSettings); + VERB3 log("Load kerneloops.conf settings"); + } + else + { + LoadPluginSettings(ssprintf(PLUGINS_CONF_DIR"/%s."PLUGINS_CONF_EXTENSION, pName).c_str(), pluginSettings); + VERB3 log("Load %s.conf settings", pName); + } try { plugin->Init(); diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py index ee802a88..f34ac2e6 100644 --- a/src/Gui/CCMainWindow.py +++ b/src/Gui/CCMainWindow.py @@ -202,10 +202,12 @@ class MainWindow(): except: icon = None if os.getuid() == 0: - try: - user = pwd.getpwuid(int(entry.getUID()))[0] - except Exception, e: - user = _("Can't get username for uid %s" % entry.getUID()) + user = "N/A" + if entry.getUID() != "-1": + try: + user = pwd.getpwuid(int(entry.getUID()))[0] + except Exception, e: + user = "UID: %s" % entry.getUID() n = self.dumpsListStore.append([icon, entry.getPackage(), entry.getExecutable(), entry.getTime("%c"), entry.getCount(), user, entry.isReported(), entry]) else: diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py index bfc13188..511e4bce 100644 --- a/src/Gui/CC_gui_functions.py +++ b/src/Gui/CC_gui_functions.py @@ -141,9 +141,11 @@ def gui_question_dialog ( message, parent_dialog=None, dialog = gtk.MessageDialog( parent_dialog, gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, - message_type, gtk.BUTTONS_YES_NO, + message_type, gtk.BUTTONS_NONE, message ) dialog.add_button("gtk-cancel", gtk.RESPONSE_CANCEL) + dialog.add_button("gtk-no", gtk.RESPONSE_NO) + dialog.add_button("gtk-yes", gtk.RESPONSE_YES) dialog.set_markup(message) if parent_dialog: dialog.set_position (gtk.WIN_POS_CENTER_ON_PARENT) diff --git a/src/Hooks/CCpp.cpp b/src/Hooks/CCpp.cpp index 2b753819..138d0d66 100644 --- a/src/Hooks/CCpp.cpp +++ b/src/Hooks/CCpp.cpp @@ -1,8 +1,8 @@ /* CCpp.cpp - the hook for C/C++ crashing program - Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) - Copyright (C) 2009 RedHat inc. + Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) + Copyright (C) 2009 RedHat inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,17 +19,15 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "abrtlib.h" - #include "DebugDump.h" #include "ABRTException.h" #include <syslog.h> -#include <string> #define FILENAME_EXECUTABLE "executable" #define FILENAME_CMDLINE "cmdline" #define FILENAME_COREDUMP "coredump" -#define VAR_RUN_PID_FILE VAR_RUN"/abrt.pid" +#define VAR_RUN_PID_FILE VAR_RUN"/abrt.pid" static char* get_executable(pid_t pid) { @@ -46,16 +44,71 @@ static char* get_executable(pid_t pid) return NULL; } +static char *append_escaped(char *start, const char *s) +{ + char hex_char_buf[] = "\\x00"; + + *start++ = ' '; + char *dst = start; + const unsigned char *p = (unsigned char *)s; + + while (1) + { + const unsigned char *old_p = p; + while (*p > ' ' && *p <= 0x7e && *p != '\"' && *p != '\'' && *p != '\\') + p++; + if (dst == start) + { + if (p != (unsigned char *)s && *p == '\0') + { + /* entire word does not need escaping and quoting */ + strcpy(dst, s); + dst += strlen(s); + return dst; + } + *dst++ = '\''; + } + + strncpy(dst, s, (p - old_p)); + dst += (p - old_p); + + if (*p == '\0') + { + *dst++ = '\''; + *dst = '\0'; + return dst; + } + const char *a; + switch (*p) + { + case '\r': a = "\\r"; break; + case '\n': a = "\\n"; break; + case '\t': a = "\\t"; break; + case '\'': a = "\\\'"; break; + case '\"': a = "\\\""; break; + case '\\': a = "\\\\"; break; + case ' ': a = " "; break; + default: + hex_char_buf[2] = "0123456789abcdef"[*p >> 4]; + hex_char_buf[3] = "0123456789abcdef"[*p & 0xf]; + a = hex_char_buf; + } + strcpy(dst, a); + dst += strlen(a); + p++; + } +} + // taken from kernel #define COMMAND_LINE_SIZE 2048 - static char* get_cmdline(pid_t pid) { - char path[PATH_MAX]; + char path[sizeof("/proc/%u/cmdline") + sizeof(int)*3]; char cmdline[COMMAND_LINE_SIZE]; - snprintf(path, sizeof(path), "/proc/%u/cmdline", (int)pid); - int idx = 0; + char escaped_cmdline[COMMAND_LINE_SIZE*4 + 4]; + escaped_cmdline[1] = '\0'; + sprintf(path, "/proc/%u/cmdline", (int)pid); int fd = open(path, O_RDONLY); if (fd >= 0) { @@ -64,33 +117,18 @@ static char* get_cmdline(pid_t pid) if (len > 0) { - /* In Linux, there is always one trailing NUL byte, - * prevent it from being replaced by space below. - */ - if (cmdline[len - 1] == '\0') - len--; - - while (idx < len) + cmdline[len] = '\0'; + char *src = cmdline; + char *dst = escaped_cmdline; + while ((src - cmdline) < len) { - unsigned char ch = cmdline[idx]; - if (ch == '\0') - { - cmdline[idx++] = ' '; - } - else if (ch >= ' ' && ch <= 0x7e) - { - cmdline[idx++] = ch; - } - else - { - cmdline[idx++] = '?'; - } + dst = append_escaped(dst, src); + src += strlen(src) + 1; } } } - cmdline[idx] = '\0'; - return xstrdup(cmdline); + return xstrdup(escaped_cmdline + 1); /* +1 skips extraneous leading space */ } static int daemon_is_ok() @@ -169,34 +207,65 @@ int main(int argc, char** argv) { error_msg_and_die("can't read /proc/%u/exe link", (int)pid); } - if (strstr(executable, "/abrt")) + if (strstr(executable, "/hookCCpp")) { - /* free(executable); - why bother? */ - error_msg_and_die("pid %u is '%s', not dumping it to avoid abrt recursion", + error_msg_and_die("pid %u is '%s', not dumping it to avoid recursion", (int)pid, executable); } + char path[PATH_MAX]; + + if (strstr(executable, "/abrtd")) + { + /* If abrtd crashes, we don't want to create a _directory_, + * since that can make new copy of abrtd to process it, + * and maybe crash again... + * On the contrary, mere files are ignored by abrtd. + */ + snprintf(path, sizeof(path), "%s/abrtd-coredump", dddir); + int fd = xopen3(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); + off_t size = copyfd_eof(STDIN_FILENO, fd); + if (size < 0 || close(fd) != 0) + { + unlink(path); + /* copyfd_eof logs the error including errno string, + * but it does not log file name */ + error_msg_and_die("error saving coredump to %s", path); + } + log("saved core dump of pid %u to %s (%llu bytes)", (int)pid, path, (long long)size); + return 0; + } + + /* rhbz#539551: "abrt going crazy when crashing process is respawned". + * Do we want to protect against or ameliorate this? How? Ideas: + * (1) nice ourself? + * (2) check total size of dump dir, if it overflows, either abort dump + * or delete oldest/biggest dumps? [abort would be simpler, + * abrtd already does "delete on overflow" thing] + * (3) detect parallel dumps in progress and back off + * (pause/renice further/??) + */ + char* cmdline = get_cmdline(pid); /* never NULL */ + const char *signame = strsignal(atoi(signal_str)); + char *reason = xasprintf("Process was terminated by signal %s (%s)", signal_str, signame ? signame : signal_str); - char path[PATH_MAX]; snprintf(path, sizeof(path), "%s/ccpp-%ld-%u", dddir, (long)time(NULL), (int)pid); - CDebugDump dd; dd.Create(path, uid); dd.SaveText(FILENAME_ANALYZER, "CCpp"); dd.SaveText(FILENAME_EXECUTABLE, executable); dd.SaveText(FILENAME_CMDLINE, cmdline); - dd.SaveText(FILENAME_REASON, ssprintf("Process was terminated by signal %s", signal_str).c_str()); + dd.SaveText(FILENAME_REASON, reason); int len = strlen(path); snprintf(path + len, sizeof(path) - len, "/"FILENAME_COREDUMP); - int fd; /* We need coredumps to be readable by all, because * process producing backtraces is run under the same UID * as the crashed process. * Thus 644, not 600 */ - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); + int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { dd.Delete(); @@ -216,6 +285,7 @@ int main(int argc, char** argv) /* free(executable); - why bother? */ /* free(cmdline); */ log("saved core dump of pid %u to %s (%llu bytes)", (int)pid, path, (long long)size); + return 0; } catch (CABRTException& e) { |