diff options
| author | Karel Klic <kklic@redhat.com> | 2010-02-04 11:28:18 +0100 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2010-02-04 11:28:18 +0100 |
| commit | 7832c5a66672c63ebda91554bd463b85669755bb (patch) | |
| tree | a0164bbd558399128a8329f13f0f32121ab7f4e0 /lib | |
| parent | e45356512a661c4dd1d4d18bc40c37a3ffb3b989 (diff) | |
| parent | a50985f228686b8eecd7025a0851001f216c71d6 (diff) | |
| download | abrt-7832c5a66672c63ebda91554bd463b85669755bb.tar.gz abrt-7832c5a66672c63ebda91554bd463b85669755bb.tar.xz abrt-7832c5a66672c63ebda91554bd463b85669755bb.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Plugins/Bugzilla.GTKBuilder | 11 | ||||
| -rw-r--r-- | lib/Plugins/CCpp.cpp | 150 | ||||
| -rw-r--r-- | lib/Plugins/Catcut.GTKBuilder | 11 | ||||
| -rw-r--r-- | lib/Plugins/KerneloopsReporter.GTKBuilder | 11 | ||||
| -rw-r--r-- | lib/Plugins/Logger.GTKBuilder | 11 | ||||
| -rw-r--r-- | lib/Plugins/Mailx.GTKBuilder | 11 | ||||
| -rw-r--r-- | lib/Plugins/Makefile.am | 1 | ||||
| -rw-r--r-- | lib/Plugins/TicketUploader.GTKBuilder | 11 | ||||
| -rw-r--r-- | lib/Plugins/TicketUploader.cpp | 18 | ||||
| -rw-r--r-- | lib/Utils/CrashTypes.cpp | 1 |
10 files changed, 188 insertions, 48 deletions
diff --git a/lib/Plugins/Bugzilla.GTKBuilder b/lib/Plugins/Bugzilla.GTKBuilder index 27af868..8c662c3 100644 --- a/lib/Plugins/Bugzilla.GTKBuilder +++ b/lib/Plugins/Bugzilla.GTKBuilder @@ -7,6 +7,7 @@ <property name="resizable">False</property> <property name="modal">True</property> <property name="window_position">center-on-parent</property> + <property name="icon_name">/usr/share/pixmaps/abrt.png</property> <property name="type_hint">normal</property> <property name="has_separator">False</property> <child internal-child="vbox"> @@ -199,8 +200,8 @@ <property name="visible">True</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="bApply"> - <property name="label">gtk-apply</property> + <object class="GtkButton" id="button2"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -213,8 +214,8 @@ </packing> </child> <child> - <object class="GtkButton" id="button2"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="bApply"> + <property name="label">gtk-apply</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -236,8 +237,8 @@ </object> </child> <action-widgets> - <action-widget response="-10">bApply</action-widget> <action-widget response="-6">button2</action-widget> + <action-widget response="-10">bApply</action-widget> </action-widgets> </object> <object class="GtkAction" id="action1"/> diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index b6305a2..612d40c 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -266,7 +266,7 @@ static void GetBacktrace(const char *pDebugDumpDir, unsetenv("TERM"); putenv((char*)"TERM=dumb"); - char *args[15]; + char *args[17]; args[0] = (char*)"gdb"; args[1] = (char*)"-batch"; @@ -294,14 +294,14 @@ static void GetBacktrace(const char *pDebugDumpDir, * * Fedora GDB does not strictly need it, it will find the binary * by its build-id. But for binaries either without build-id - * (=built on non-Fedora GCC) or which do not have + * (= built on non-Fedora GCC) or which do not have * their debuginfo rpm installed gdb would not find BINARY_FILE * so it is still makes sense to supply "file BINARY_FILE". * * Unfortunately, "file BINARY_FILE" doesn't work well if BINARY_FILE * was deleted (as often happens during system updates): * gdb uses specified BINARY_FILE - * even if it is completely unrelated to the coredump + * even if it is completely unrelated to the coredump. * See https://bugzilla.redhat.com/show_bug.cgi?id=525721 * * TODO: check mtimes on COREFILE and BINARY_FILE and not supply @@ -316,16 +316,43 @@ static void GetBacktrace(const char *pDebugDumpDir, args[7] = (char*)corefile.c_str(); args[8] = (char*)"-ex"; - /* max 3000 frames: with no limit, gdb sometimes OOMs the machine */ - args[9] = (char*)"thread apply all backtrace 3000 full"; + /*args[9] = ... see below */ args[10] = (char*)"-ex"; args[11] = (char*)"info sharedlib"; /* glibc's abort() stores its message in this variable */ args[12] = (char*)"-ex"; args[13] = (char*)"print (char*)__abort_msg"; - args[14] = NULL; - - ExecVP(args, xatoi_u(UID.c_str()), /*redirect_stderr:*/ 1, pBacktrace); + args[14] = (char*)"-ex"; + args[15] = (char*)"print (char*)__glib_assert_msg"; + args[16] = NULL; + + /* Get the backtrace, but try to cap its size */ + /* Limit bt depth. With no limit, gdb sometimes OOMs the machine */ + unsigned bt_depth = 2048; + const char *thread_apply_all = "thread apply all "; + const char *full = " full"; + while (1) + { + string cmd = ssprintf("%sbacktrace %u%s", thread_apply_all, bt_depth, full); + args[9] = (char*)cmd.c_str(); + pBacktrace = ""; + ExecVP(args, xatoi_u(UID.c_str()), /*redirect_stderr:*/ 1, pBacktrace); + if (bt_depth <= 64 || pBacktrace.size() < 256*1024) + return; + bt_depth /= 2; + if (bt_depth <= 64 && thread_apply_all[0] != '\0') + { + /* This program likely has gazillion threads, dont try to bt them all */ + bt_depth = 256; + thread_apply_all = ""; + } + if (bt_depth <= 64 && full[0] != '\0') + { + /* Looks like there are gigantic local structures or arrays, disable "full" bt */ + bt_depth = 256; + full = ""; + } + } } static void GetIndependentBuildIdPC(const char *unstrip_n_output, @@ -548,7 +575,37 @@ string CAnalyzerCCpp::GetLocalUUID(const char *pDebugDumpDir) string unstrip_n_output = run_unstrip_n(pDebugDumpDir); string independentBuildIdPC; GetIndependentBuildIdPC(unstrip_n_output.c_str(), independentBuildIdPC); - return CreateHash((package + executable + independentBuildIdPC).c_str()); + + /* package variable has "firefox-3.5.6-1.fc11[.1]" format */ + /* Remove distro suffix and maybe least significant version number */ + char *trimmed_package = xstrdup(package.c_str()); + char *p = trimmed_package; + while (*p) + { + if (*p == '.' && (p[1] < '0' || p[1] > '9')) + { + /* We found "XXXX.nondigitXXXX", trim this part */ + *p = '\0'; + break; + } + p++; + } + char *first_dot = strchr(trimmed_package, '.'); + if (first_dot) + { + char *last_dot = strrchr(first_dot, '.'); + if (last_dot != first_dot) + { + /* There are more than one dot: "1.2.3" + * Strip last part, we don't want to distinquish crashes + * in packages which differ only by minor release number. + */ + *last_dot = '\0'; + } + } + string hash_str = trimmed_package + executable + independentBuildIdPC; + free(trimmed_package); + return CreateHash(hash_str.c_str()); } string CAnalyzerCCpp::GetGlobalUUID(const char *pDebugDumpDir) @@ -746,6 +803,76 @@ void CAnalyzerCCpp::CreateReport(const char *pDebugDumpDir, int force) dd.SaveText(FILENAME_RATING, to_string(rate_backtrace(backtrace.c_str())).c_str()); dd.Close(); } +/* + this is just a workaround until kernel changes it's behavior + when handling pipes in core_pattern +*/ +#ifdef HOSTILE_KERNEL +#define CORE_SIZE_PATTERN "Max core file size=1:unlimited" +static int isdigit_str(char *str) +{ + do { + if (*str < '0' || *str > '9') + return 0; + } while (*++str); + return 1; +} + +static int set_limits() +{ + DIR *dir = opendir("/proc"); + if (!dir) { + /* this shouldn't fail, but to be safe.. */ + return 1; + } + + struct dirent *ent; + while ((ent = readdir(dir)) != NULL) { + if (!isdigit_str(ent->d_name)) + continue; + + char limits_name[sizeof("/proc/%s/limits") + sizeof(int)]; + snprintf(limits_name, sizeof(limits_name), "/proc/%s/limits", ent->d_name); + FILE *limits_fp = fopen(limits_name, "r"); + if (!limits_fp) { + break; + } + + char line[128]; + char *ulimit_c = NULL; + while (1) { + if (fgets(line, sizeof(line)-1, limits_fp) == NULL) + break; + if (strncmp(line, "Max core file size", sizeof("Max core file size")-1) == 0) { + ulimit_c = skip_whitespace(line + sizeof("Max core file size")-1); + skip_non_whitespace(ulimit_c)[0] = '\0'; + break; + } + } + fclose(limits_fp); + if (!ulimit_c || ulimit_c[0] != '0' || ulimit_c[1] != '\0') { + /*process has nonzero ulimit -c, so need to modify it*/ + continue; + } + /* echo -n 'Max core file size=1:unlimited' >/proc/PID/limits */ + int fd = open(limits_name, O_WRONLY); + if (fd >= 0) { + errno = 0; + /*full_*/ + ssize_t n = write(fd, CORE_SIZE_PATTERN, sizeof(CORE_SIZE_PATTERN)-1); + if (n < sizeof(CORE_SIZE_PATTERN)-1) + log("warning: can't write core_size limit to: %s", limits_name); + close(fd); + } + else + { + log("warning: can't open %s for writing", limits_name); + } + } + closedir(dir); + return 0; +} +#endif /* HOSTILE_KERNEL */ void CAnalyzerCCpp::Init() { @@ -773,6 +900,11 @@ void CAnalyzerCCpp::Init() CORE_PATTERN_IFACE, CORE_PATTERN); } } +#ifdef HOSTILE_KERNEL + if(set_limits() != 0) + log("warning: failed to set core_size limit, ABRT won't detect crashes in" + "compiled apps"); +#endif ofstream fOutCorePattern; fOutCorePattern.open(CORE_PATTERN_IFACE); diff --git a/lib/Plugins/Catcut.GTKBuilder b/lib/Plugins/Catcut.GTKBuilder index 9f314f0..1207478 100644 --- a/lib/Plugins/Catcut.GTKBuilder +++ b/lib/Plugins/Catcut.GTKBuilder @@ -7,6 +7,7 @@ <property name="resizable">False</property> <property name="modal">True</property> <property name="window_position">center-on-parent</property> + <property name="icon">/usr/share/pixmaps/abrt.png</property> <property name="type_hint">normal</property> <property name="has_separator">False</property> <child internal-child="vbox"> @@ -165,8 +166,8 @@ <property name="visible">True</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="bApply"> - <property name="label">gtk-apply</property> + <object class="GtkButton" id="button2"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -179,8 +180,8 @@ </packing> </child> <child> - <object class="GtkButton" id="button2"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="bApply"> + <property name="label">gtk-apply</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -202,8 +203,8 @@ </object> </child> <action-widgets> - <action-widget response="-10">bApply</action-widget> <action-widget response="-6">button2</action-widget> + <action-widget response="-10">bApply</action-widget> </action-widgets> </object> </interface> diff --git a/lib/Plugins/KerneloopsReporter.GTKBuilder b/lib/Plugins/KerneloopsReporter.GTKBuilder index 65f993f..dbe6c96 100644 --- a/lib/Plugins/KerneloopsReporter.GTKBuilder +++ b/lib/Plugins/KerneloopsReporter.GTKBuilder @@ -6,6 +6,7 @@ <property name="border_width">12</property> <property name="resizable">False</property> <property name="modal">True</property> + <property name="icon">/usr/share/pixmaps/abrt.png</property> <property name="type_hint">normal</property> <property name="has_separator">False</property> <child internal-child="vbox"> @@ -73,8 +74,8 @@ <property name="visible">True</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="button1"> - <property name="label" translatable="yes">gtk-apply</property> + <object class="GtkButton" id="button2"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -87,8 +88,8 @@ </packing> </child> <child> - <object class="GtkButton" id="button2"> - <property name="label" translatable="yes">gtk-cancel</property> + <object class="GtkButton" id="button1"> + <property name="label">gtk-apply</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -110,8 +111,8 @@ </object> </child> <action-widgets> - <action-widget response="-10">button1</action-widget> <action-widget response="-6">button2</action-widget> + <action-widget response="-10">button1</action-widget> </action-widgets> </object> </interface> diff --git a/lib/Plugins/Logger.GTKBuilder b/lib/Plugins/Logger.GTKBuilder index 26ac10f..8863360 100644 --- a/lib/Plugins/Logger.GTKBuilder +++ b/lib/Plugins/Logger.GTKBuilder @@ -7,6 +7,7 @@ <property name="resizable">False</property> <property name="modal">True</property> <property name="window_position">center-on-parent</property> + <property name="icon">/usr/share/pixmaps/abrt.png</property> <property name="type_hint">normal</property> <property name="has_separator">False</property> <child internal-child="vbox"> @@ -90,8 +91,8 @@ <property name="visible">True</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="button1"> - <property name="label" translatable="yes">gtk-apply</property> + <object class="GtkButton" id="button2"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -104,8 +105,8 @@ </packing> </child> <child> - <object class="GtkButton" id="button2"> - <property name="label" translatable="yes">gtk-cancel</property> + <object class="GtkButton" id="button1"> + <property name="label">gtk-apply</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -127,8 +128,8 @@ </object> </child> <action-widgets> - <action-widget response="-10">button1</action-widget> <action-widget response="-6">button2</action-widget> + <action-widget response="-10">button1</action-widget> </action-widgets> </object> </interface> diff --git a/lib/Plugins/Mailx.GTKBuilder b/lib/Plugins/Mailx.GTKBuilder index 55647e1..079e27c 100644 --- a/lib/Plugins/Mailx.GTKBuilder +++ b/lib/Plugins/Mailx.GTKBuilder @@ -7,6 +7,7 @@ <property name="resizable">False</property> <property name="modal">True</property> <property name="window_position">center-on-parent</property> + <property name="icon">/usr/share/pixmaps/abrt.png</property> <property name="type_hint">normal</property> <property name="has_separator">False</property> <child internal-child="vbox"> @@ -139,8 +140,8 @@ <property name="visible">True</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="button1"> - <property name="label">gtk-apply</property> + <object class="GtkButton" id="button2"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -153,8 +154,8 @@ </packing> </child> <child> - <object class="GtkButton" id="button2"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="button1"> + <property name="label">gtk-apply</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -176,8 +177,8 @@ </object> </child> <action-widgets> - <action-widget response="-10">button1</action-widget> <action-widget response="-6">button2</action-widget> + <action-widget response="-10">button1</action-widget> </action-widgets> </object> </interface> diff --git a/lib/Plugins/Makefile.am b/lib/Plugins/Makefile.am index 7c03eac..e2bcf08 100644 --- a/lib/Plugins/Makefile.am +++ b/lib/Plugins/Makefile.am @@ -59,6 +59,7 @@ libCCpp_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../Utils \ -DCCPP_HOOK_PATH=\"${libexecdir}/abrt-hook-ccpp\" \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DLOCALSTATEDIR='"$(localstatedir)"' +# -DHOSTILE_KERNEL # Firefox - disabled for now diff --git a/lib/Plugins/TicketUploader.GTKBuilder b/lib/Plugins/TicketUploader.GTKBuilder index 4695a31..36b1dd9 100644 --- a/lib/Plugins/TicketUploader.GTKBuilder +++ b/lib/Plugins/TicketUploader.GTKBuilder @@ -7,6 +7,7 @@ <property name="resizable">False</property> <property name="modal">True</property> <property name="window_position">center-on-parent</property> + <property name="icon">/usr/share/pixmaps/abrt.png</property> <property name="type_hint">normal</property> <property name="has_separator">False</property> <child internal-child="vbox"> @@ -203,8 +204,8 @@ <property name="visible">True</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="bApply"> - <property name="label" translatable="yes">gtk-apply</property> + <object class="GtkButton" id="button2"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -217,8 +218,8 @@ </packing> </child> <child> - <object class="GtkButton" id="button2"> - <property name="label" translatable="yes">gtk-cancel</property> + <object class="GtkButton" id="bApply"> + <property name="label">gtk-apply</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -240,8 +241,8 @@ </object> </child> <action-widgets> - <action-widget response="-10">bApply</action-widget> <action-widget response="-6">button2</action-widget> + <action-widget response="-10">bApply</action-widget> </action-widgets> </object> <object class="GtkAction" id="action1"/> diff --git a/lib/Plugins/TicketUploader.cpp b/lib/Plugins/TicketUploader.cpp index 8ac6a87..d924b91 100644 --- a/lib/Plugins/TicketUploader.cpp +++ b/lib/Plugins/TicketUploader.cpp @@ -435,7 +435,7 @@ map_plugin_settings_t CTicketUploader::parse_settings(const map_plugin_settings_ map_plugin_settings_t::const_iterator end = pSettings.end(); map_plugin_settings_t::const_iterator it; - + it = pSettings.find("Customer"); if (it == end) { @@ -443,7 +443,7 @@ map_plugin_settings_t CTicketUploader::parse_settings(const map_plugin_settings_ return plugin_settings; } plugin_settings["Customer"] = it->second; - + it = pSettings.find("Ticket"); if (it == end) { @@ -451,7 +451,7 @@ map_plugin_settings_t CTicketUploader::parse_settings(const map_plugin_settings_ return plugin_settings; } plugin_settings["Ticket"] = it->second; - + it = pSettings.find("URL"); if (it == end) { @@ -459,7 +459,7 @@ map_plugin_settings_t CTicketUploader::parse_settings(const map_plugin_settings_ return plugin_settings; } plugin_settings["URL"] = it->second; - + it = pSettings.find("Encrypt"); if (it == end) { @@ -467,7 +467,7 @@ map_plugin_settings_t CTicketUploader::parse_settings(const map_plugin_settings_ return plugin_settings; } plugin_settings["Encrypt"] = it->second; - + it = pSettings.find("Upload"); if (it == end) { @@ -475,7 +475,7 @@ map_plugin_settings_t CTicketUploader::parse_settings(const map_plugin_settings_ return plugin_settings; } plugin_settings["Upload"] = it->second; - + it = pSettings.find("RetryCount"); if (it == end) { @@ -483,7 +483,7 @@ map_plugin_settings_t CTicketUploader::parse_settings(const map_plugin_settings_ return plugin_settings; } plugin_settings["RetryCount"] = it->second; - + it = pSettings.find("RetryDelay"); if (it == end) { @@ -491,7 +491,7 @@ map_plugin_settings_t CTicketUploader::parse_settings(const map_plugin_settings_ return plugin_settings; } plugin_settings["RetryDelay"] = it->second; - + VERB1 log("User settings ok, using them instead of defaults"); return plugin_settings; } @@ -500,7 +500,7 @@ PLUGIN_INFO(REPORTER, CTicketUploader, "TicketUploader", "0.0.1", - "Asks ticket# and customer name from user, sends report to FTP", + "Packs crash data into .tar.gz file, optionally uploads it via FTP/SCP/etc", "gavin@redhat.com", "https://fedorahosted.org/abrt/wiki", PLUGINS_LIB_DIR"/TicketUploader.GTKBuilder"); diff --git a/lib/Utils/CrashTypes.cpp b/lib/Utils/CrashTypes.cpp index 4fc9333..b50535b 100644 --- a/lib/Utils/CrashTypes.cpp +++ b/lib/Utils/CrashTypes.cpp @@ -35,6 +35,7 @@ static const char *const editable_files[] = { FILENAME_COMMENT , FILENAME_REPRODUCE , FILENAME_BACKTRACE , + FILENAME_KERNELOOPS , NULL }; |
