[PATCH 0/2] Please review: function fingerprinting implementation
by Martin Milata
The patches implement function fingerprinting for coredump-level backtraces as
described in [1]. Note that it is not compiled by default, you need to pass
'--enable-dupcheck-fingerprint' to the configure script.
You can also checkout the branch 'function_fingerprints' from abrt git instead
of applying the patches.
Martin
[1] https://fedorahosted.org/abrt/wiki/FunctionFingerprints
Martin Milata (2):
a-a-g-c-b: Function for PLT parsing
a-a-g-c-b: Fingerprinting implementation
doc/abrt-action-generate-core-backtrace.txt | 8 +-
src/plugins/abrt-action-generate-core-backtrace.c | 906 ++++++++++++++++++---
2 files changed, 789 insertions(+), 125 deletions(-)
--
1.7.7.6
12 years
[PATCH] GUI rework: simple mode + expert mode
by Denys Vlasenko
Hi,
This patch set modifies GUI so that for non-IT users
abrt provides fewer screens. For developers, a somewhat
hidden option exists to see all data, all possible events
and run them in any order:
in abrt-gui, select "Edit"->"Open problem data".
This is called "expert mode".
To this end, report-gtk acquired a new option, -e EVENT,
which specifies which event(s) to run. Without -e,
we get expert mode.
To make behavior configurable, new events, report-gui
and open-gui, are used by abrt-gui and applet to start reporting,
or to do "Edit"->"Open problem data" thing.
If events are not defined, they fall back to direct execution
of "report-gtk $DUMP_DIR".
Open question is how to select -e EVENT options in lieu
of third-party analyzers or collectors...
Patches are tested to apply to current gits (with some offsets).
Preparatory libreport1.patch is already in git and thus is not attached.
Patches are run-tested. The intermediate libreportN.patch
patches show gradual changes as I massaged the source
into implementing new logic.
Please review.
--
vda
12 years
[PATCHv2 (snprintf and sizeof)] trakc#480 : use macro with ISO date sample instead of literal to compute required size of arrays used as buffers in snprintf() function call
by Jakub Filak
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/include/internal_libreport.h | 1 +
src/lib/create_dump_dir.c | 4 ++--
src/lib/iso_date_string.c | 2 +-
src/plugins/reporter-rhtsupport.c | 5 ++---
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index 892a70f..42c94f7 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -567,6 +567,7 @@ char* get_environ(pid_t pid);
*/
#define iso_date_string libreport_iso_date_string
char *iso_date_string(const time_t *pt);
+#define LIBREPORT_ISO_DATE_STRING_SAMPLE "YYYY-MM-DD-hh:mm:ss"
enum {
MAKEDESC_SHOW_FILES = (1 << 0),
diff --git a/src/lib/create_dump_dir.c b/src/lib/create_dump_dir.c
index 27e3761..42fbc7d 100644
--- a/src/lib/create_dump_dir.c
+++ b/src/lib/create_dump_dir.c
@@ -29,8 +29,8 @@ static struct dump_dir *try_dd_create(const char *base_dir_name, const char *dir
struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)
{
- char dir_name[sizeof("abrt-tmp-YYYY-MM-DD-HH:MM:SS-%lu") + sizeof(long)*3];
- sprintf(dir_name, "abrt-tmp-%s-%lu", iso_date_string(NULL), (long)getpid());
+ char dir_name[sizeof("abrt-tmp-"LIBREPORT_ISO_DATE_STRING_SAMPLE"-%lu") + sizeof(long)*3];
+ snprintf(dir_name, sizeof(dir_name), "abrt-tmp-%s-%lu", iso_date_string(NULL), (long)getpid());
struct dump_dir *dd;
if (base_dir_name)
diff --git a/src/lib/iso_date_string.c b/src/lib/iso_date_string.c
index ae35cea..2db0d29 100644
--- a/src/lib/iso_date_string.c
+++ b/src/lib/iso_date_string.c
@@ -21,7 +21,7 @@
char *iso_date_string(const time_t *pt)
{
- static char buf[sizeof("YYYY-MM-DD-HH:MM:SS") + 4];
+ static char buf[sizeof(LIBREPORT_ISO_DATE_STRING_SAMPLE) + 4];
time_t t;
struct tm *ptm = localtime(pt ? pt : (time(&t), &t));
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index ead5904..4e4cccb 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -230,9 +230,8 @@ int main(int argc, char **argv)
dsc = make_description_bz(problem_data, CD_TEXT_ATT_SIZE_BZ);
}
file = new_reportfile();
- const char *dt_string = iso_date_string(NULL);
- char tmpdir_name[sizeof("/tmp/rhtsupport-YYYY-MM-DD-hh:mm:ss-XXXXXX")];
- sprintf(tmpdir_name, "/tmp/rhtsupport-%s-XXXXXX", dt_string);
+ char tmpdir_name[sizeof("/tmp/rhtsupport-"LIBREPORT_ISO_DATE_STRING_SAMPLE"-XXXXXX")];
+ snprintf(tmpdir_name, sizeof(tmpdir_name), "/tmp/rhtsupport-%s-XXXXXX", iso_date_string(NULL));
/* mkdtemp does mkdir(xxx, 0700), should be safe (is it?) */
if (mkdtemp(tmpdir_name) == NULL)
{
--
1.7.7.6
12 years
[PATCH 1/2] reporter-bugzilla: fixed memory leak in is_comment_dup() function
by Jakub Filak
---
src/plugins/rhbz.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index a3aa2ef..2e7d62c 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -88,20 +88,19 @@ static char *trim_all_whitespace(const char *str)
int is_comment_dup(GList *comments, const char *comment)
{
- for (GList *l = comments; l; l = l->next)
+ char * const trim_comment = trim_all_whitespace(comment);
+ bool same_comments = false;
+
+ for (GList *l = comments; l && !same_comments; l = l->next)
{
- char *comment_body = (char *) l->data;
- char *trim_comment_body = trim_all_whitespace(comment_body);
- char *trim_comment = trim_all_whitespace(comment);
- if (!strcmp(trim_comment_body, trim_comment))
- {
- free(trim_comment_body);
- free(trim_comment);
- return 1;
- }
+ const char * const comment_body = (const char *) l->data;
+ char * const trim_comment_body = trim_all_whitespace(comment_body);
+ same_comments = !strcmp(trim_comment_body, trim_comment);
+ free(trim_comment_body);
}
- return 0;;
+ free(trim_comment);
+ return same_comments;
}
static unsigned find_best_bt_rating_in_comments(GList *comments)
--
1.7.7.6
12 years
[PATCH] coverity: use macro with ISO date sample instead of literal to compute required size of arrays used as buffers in snprintf() function call
by Jakub Filak
---
src/include/internal_libreport.h | 1 +
src/lib/create_dump_dir.c | 5 +++--
src/lib/iso_date_string.c | 2 +-
src/plugins/reporter-rhtsupport.c | 6 +++---
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index 892a70f..42c94f7 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -567,6 +567,7 @@ char* get_environ(pid_t pid);
*/
#define iso_date_string libreport_iso_date_string
char *iso_date_string(const time_t *pt);
+#define LIBREPORT_ISO_DATE_STRING_SAMPLE "YYYY-MM-DD-hh:mm:ss"
enum {
MAKEDESC_SHOW_FILES = (1 << 0),
diff --git a/src/lib/create_dump_dir.c b/src/lib/create_dump_dir.c
index 27e3761..fb17d57 100644
--- a/src/lib/create_dump_dir.c
+++ b/src/lib/create_dump_dir.c
@@ -29,8 +29,9 @@ static struct dump_dir *try_dd_create(const char *base_dir_name, const char *dir
struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data, const char *base_dir_name)
{
- char dir_name[sizeof("abrt-tmp-YYYY-MM-DD-HH:MM:SS-%lu") + sizeof(long)*3];
- sprintf(dir_name, "abrt-tmp-%s-%lu", iso_date_string(NULL), (long)getpid());
+ const size_t tmp_required_size=sizeof("abrt-tmp-"LIBREPORT_ISO_DATE_STRING_SAMPLE"-%lu") + sizeof(long)*3;
+ char dir_name[tmp_required_size];
+ snprintf(dir_name, tmp_required_size, "abrt-tmp-%s-%lu", iso_date_string(NULL), (long)getpid());
struct dump_dir *dd;
if (base_dir_name)
diff --git a/src/lib/iso_date_string.c b/src/lib/iso_date_string.c
index ae35cea..2db0d29 100644
--- a/src/lib/iso_date_string.c
+++ b/src/lib/iso_date_string.c
@@ -21,7 +21,7 @@
char *iso_date_string(const time_t *pt)
{
- static char buf[sizeof("YYYY-MM-DD-HH:MM:SS") + 4];
+ static char buf[sizeof(LIBREPORT_ISO_DATE_STRING_SAMPLE) + 4];
time_t t;
struct tm *ptm = localtime(pt ? pt : (time(&t), &t));
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index ead5904..d90d744 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -230,9 +230,9 @@ int main(int argc, char **argv)
dsc = make_description_bz(problem_data, CD_TEXT_ATT_SIZE_BZ);
}
file = new_reportfile();
- const char *dt_string = iso_date_string(NULL);
- char tmpdir_name[sizeof("/tmp/rhtsupport-YYYY-MM-DD-hh:mm:ss-XXXXXX")];
- sprintf(tmpdir_name, "/tmp/rhtsupport-%s-XXXXXX", dt_string);
+ const size_t tmp_required_size=sizeof("/tmp/rhtsupport-"LIBREPORT_ISO_DATE_STRING_SAMPLE"-XXXXXX");
+ char tmpdir_name[tmp_required_size];
+ snprintf(tmpdir_name, tmp_required_size, "/tmp/rhtsupport-%s-XXXXXX", iso_date_string(NULL));
/* mkdtemp does mkdir(xxx, 0700), should be safe (is it?) */
if (mkdtemp(tmpdir_name) == NULL)
{
--
1.7.7.6
12 years
[PATCH] trac#526 : add check for locale.h to configure.ac and include the header if is available
by Jakub Filak
---
configure.ac | 2 ++
src/cli/cli.c | 6 +++---
src/plugins/report.c | 3 +++
src/plugins/reporter-bugzilla.c | 4 +++-
src/plugins/reporter-kerneloops.c | 3 +++
src/plugins/reporter-mailx.c | 3 +++
src/plugins/reporter-print.c | 3 +++
src/plugins/reporter-rhtsupport.c | 3 +++
src/plugins/reporter-upload.c | 3 +++
9 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 851cc89..e16b58d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,8 @@ PKG_PROG_PKG_CONFIG
AC_CHECK_HEADER([libtar.h], [],
[AC_MSG_ERROR([libtar.h is needed to build libreport])])
+AC_CHECK_HEADERS([locale.h])
+
CONF_DIR='${sysconfdir}/${PACKAGE_NAME}'
VAR_RUN='${localstatedir}/run'
PLUGINS_CONF_DIR='${sysconfdir}/${PACKAGE_NAME}/plugins'
diff --git a/src/cli/cli.c b/src/cli/cli.c
index 0072c10..db603b6 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -15,12 +15,12 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
#include <getopt.h>
#include <syslog.h>
#include "internal_libreport.h"
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
#include "cli-report.h"
static char *do_log(char *log_line, void *param)
diff --git a/src/plugins/report.c b/src/plugins/report.c
index e6e976b..3ccd541 100644
--- a/src/plugins/report.c
+++ b/src/plugins/report.c
@@ -17,6 +17,9 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "internal_libreport.h"
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif /* HAVE_LOCALE_H */
int main(int argc, char **argv)
{
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 39f356a..3165f5d 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -16,8 +16,10 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <locale.h>
#include "internal_libreport.h"
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif /* HAVE_LOCALE_H */
#include "client.h"
#include "abrt_xmlrpc.h"
#include "rhbz.h"
diff --git a/src/plugins/reporter-kerneloops.c b/src/plugins/reporter-kerneloops.c
index 81ab93e..ef8288e 100644
--- a/src/plugins/reporter-kerneloops.c
+++ b/src/plugins/reporter-kerneloops.c
@@ -18,6 +18,9 @@
*/
#include "abrt_curl.h"
#include "internal_libreport.h"
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif /* HAVE_LOCALE_H */
/* helpers */
static size_t writefunction(void *ptr, size_t size, size_t nmemb, void *stream)
diff --git a/src/plugins/reporter-mailx.c b/src/plugins/reporter-mailx.c
index 83d12e8..38a7886 100644
--- a/src/plugins/reporter-mailx.c
+++ b/src/plugins/reporter-mailx.c
@@ -17,6 +17,9 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "internal_libreport.h"
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif /* HAVE_LOCALE_H */
static void exec_and_feed_input(const char* text, char **args)
{
diff --git a/src/plugins/reporter-print.c b/src/plugins/reporter-print.c
index e7f6c3d..7efa285 100644
--- a/src/plugins/reporter-print.c
+++ b/src/plugins/reporter-print.c
@@ -19,6 +19,9 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "internal_libreport.h"
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif /* HAVE_LOCALE_H */
#include "client.h"
static const char *dump_dir_name = ".";
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index d90d744..4244a67 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -18,6 +18,9 @@
*/
#include <libtar.h>
#include "internal_libreport.h"
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif /* HAVE_LOCALE_H */
#include "client.h"
#include "abrt_curl.h"
#include "abrt_xmlrpc.h"
diff --git a/src/plugins/reporter-upload.c b/src/plugins/reporter-upload.c
index 16b588d..f43dfe7 100644
--- a/src/plugins/reporter-upload.c
+++ b/src/plugins/reporter-upload.c
@@ -19,6 +19,9 @@
#include <libtar.h>
#include "abrt_curl.h"
#include "internal_libreport.h"
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif /* HAVE_LOCALE_H */
//TODO: use this for better logging
#if 0
--
1.7.7.6
12 years
[PATCH] trac#522 : abrt vmcore plugin verbosity correction
by Jakub Filak
---
src/plugins/abrt-action-analyze-vmcore.in | 7 +++++--
src/plugins/abrt-action-install-debuginfo.in | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/plugins/abrt-action-analyze-vmcore.in b/src/plugins/abrt-action-analyze-vmcore.in
index af606c4..2e02167 100644
--- a/src/plugins/abrt-action-analyze-vmcore.in
+++ b/src/plugins/abrt-action-analyze-vmcore.in
@@ -25,7 +25,7 @@ if __name__ == "__main__":
vmlinux_di_path = ""
tmpdir = ""
vmcore = ""
- global verbose
+
help_text = _("Usage: {0} [-v[v]] [--core=VMCORE] [--tmpdir=TMPDIR] [--cache=CACHEDIR]").format(PROGNAME)
try:
opts, args = getopt.getopt(sys.argv[1:], "hvd", ["help", "tmpdir=", "cache=", "core="])
@@ -114,7 +114,10 @@ if __name__ == "__main__":
error_msg_and_die(_("Can't download required debuginfo"))
vmlinux_di_path = "{0}/usr/lib/debug/lib/modules/{1}/vmlinux".format(vmlinux_di_cachedir, ver)
else: # we need to use the suid wrapper, if we use the default cache
- downloader = Popen(["/usr/libexec/abrt-action-install-debuginfo-to-abrt-cache", "--size_mb=4096", "--exact={0}".format(vmlinux_di_path)], bufsize = -1)
+ downloader_args = ["/usr/libexec/abrt-action-install-debuginfo-to-abrt-cache", "--size_mb=4096", "--exact={0}".format(vmlinux_di_path)]
+ if 0 < verbose:
+ downloader_args.append( "-{0}".format( "v"*verbose ) )
+ downloader = Popen( downloader_args, bufsize = -1)
res = downloader.wait()
if res != 0:
error_msg_and_die(_("Can't download required debuginfo"))
diff --git a/src/plugins/abrt-action-install-debuginfo.in b/src/plugins/abrt-action-install-debuginfo.in
index a6c39f3..a50d29b 100644
--- a/src/plugins/abrt-action-install-debuginfo.in
+++ b/src/plugins/abrt-action-install-debuginfo.in
@@ -134,6 +134,8 @@ if __name__ == "__main__":
missing=arg.split(':')
exact_fls = True
+ set_verbosity( verbose )
+
if not cachedirs:
try:
fp = open("@sysconfdir@/@PACKAGE_NAME(a)/plugins/CCpp.conf", "r")
--
1.7.7.6
12 years
[PATCH] trac#523 use a vmcore from the current directory only if a path to the vmcore wasn't passed as an argument
by Jakub Filak
---
src/plugins/abrt-action-analyze-vmcore.in | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/plugins/abrt-action-analyze-vmcore.in b/src/plugins/abrt-action-analyze-vmcore.in
index 13c2bd2..af606c4 100644
--- a/src/plugins/abrt-action-analyze-vmcore.in
+++ b/src/plugins/abrt-action-analyze-vmcore.in
@@ -54,8 +54,11 @@ if __name__ == "__main__":
print str(ex)
sys.exit(RETURN_FAILURE)
- vmcore = os.path.join(os.getcwd(), "vmcore")
+ if not vmcore:
+ vmcore = os.path.join(os.getcwd(), "vmcore")
+
set_verbosity(verbose)
+
if not os.path.exists(vmcore):
print _("File {0} doesn't exist").format(vmcore)
sys.exit(RETURN_FAILURE)
--
1.7.7.6
12 years, 1 month