summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2011-04-07 16:50:25 +0200
committerKarel Klic <kklic@redhat.com>2011-04-07 16:50:25 +0200
commitf540d45ddbbe61c07b82446cd24ce870dbb4ff01 (patch)
tree0f6a485cfd364b883dfa5126778313c265a22f4a /src
parent9cd3eb3d3fbf73524d313cfaa1a81873f2e301a8 (diff)
downloadabrt-f540d45ddbbe61c07b82446cd24ce870dbb4ff01.tar.gz
abrt-f540d45ddbbe61c07b82446cd24ce870dbb4ff01.tar.xz
abrt-f540d45ddbbe61c07b82446cd24ce870dbb4ff01.zip
Better duplicate hash
Currently the duplicate hash of a crash for Bugzilla is computed from the package NVR (name, version, release), path of the executable, and the backtrace hash. This is very unfortunate because the package NVR is changed frequently (it contains Fedora OS version), and path of the executable is not a good differentiator. When multiple executables from a single component crash with similar backtrace, it is better to assume that they share code and have single Bugzilla bug report. This commit changes the code to compute the duplicate hash from the component name and the backtrace hash.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/abrt-action-analyze-backtrace.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/plugins/abrt-action-analyze-backtrace.c b/src/plugins/abrt-action-analyze-backtrace.c
index 7ae7e47c..5e59f49b 100644
--- a/src/plugins/abrt-action-analyze-backtrace.c
+++ b/src/plugins/abrt-action-analyze-backtrace.c
@@ -84,8 +84,7 @@ int main(int argc, char **argv)
if (!dd)
return 1;
- char *package = dd_load_text(dd, FILENAME_PACKAGE);
- char *executable = dd_load_text(dd, FILENAME_EXECUTABLE);
+ char *component = dd_load_text(dd, FILENAME_COMPONENT);
/* Read backtrace */
char *backtrace_str = dd_load_text_ext(dd, FILENAME_BACKTRACE,
@@ -107,15 +106,21 @@ int main(int argc, char **argv)
if (!backtrace)
{
/*
- * The parser failed. Compute the UUID from the executable
- * and package only. This is not supposed to happen often.
+ * The parser failed. Compute the duphash from the executable
+ * instead of a backtrace.
+ * and component only. This is not supposed to happen often.
*/
log(_("Backtrace parsing failed for %s"), dump_dir_name);
log("%d:%d: %s", location.line, location.column, location.message);
struct strbuf *emptybt = strbuf_new();
+
+ char *executable = dd_load_text(dd, FILENAME_EXECUTABLE);
strbuf_prepend_str(emptybt, executable);
- strbuf_prepend_str(emptybt, package);
+ free(executable);
+
+ strbuf_prepend_str(emptybt, component);
+ VERB3 log("Generating duphash: %s", emptybt->buf);
char hash_str[SHA1_RESULT_LEN*2 + 1];
create_hash(hash_str, emptybt->buf);
@@ -129,8 +134,7 @@ int main(int argc, char **argv)
dd_save_text(dd, FILENAME_RATING, "0");
strbuf_free(emptybt);
- free(package);
- free(executable);
+ free(component);
dd_close(dd);
/* Report success even if the parser failed, as the backtrace
@@ -143,10 +147,10 @@ int main(int argc, char **argv)
/* Compute duplication hash. */
char *str_hash_core = btp_backtrace_get_duplication_hash(backtrace);
struct strbuf *str_hash = strbuf_new();
- strbuf_append_str(str_hash, package);
- strbuf_append_str(str_hash, executable);
+ strbuf_append_str(str_hash, component);
strbuf_append_str(str_hash, str_hash_core);
+ VERB3 log("Generating duphash: %s", str_hash->buf);
char hash_str[SHA1_RESULT_LEN*2 + 1];
create_hash(hash_str, str_hash->buf);
@@ -182,9 +186,6 @@ int main(int argc, char **argv)
}
btp_backtrace_free(backtrace);
dd_close(dd);
-
- free(executable);
- free(package);
-
+ free(component);
return 0;
}