Blame SOURCES/0072-make_desc-add-reason-to-the-list.patch

4b6aa8
From 602457c6b4de8d4147bea2ab2264b360f7807636 Mon Sep 17 00:00:00 2001
4b6aa8
From: Matej Habrnal <mhabrnal@redhat.com>
4b6aa8
Date: Tue, 16 Sep 2014 05:30:28 +0200
4b6aa8
Subject: [LIBREPORT PATCH 72/93] make_desc: add reason to the list
4b6aa8
4b6aa8
Add reason in format "crash-function: reason". Add hostname to the uid line and
4b6aa8
add cmdline. Remove executable line.
4b6aa8
4b6aa8
Related to rhbz#1067440
4b6aa8
4b6aa8
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
4b6aa8
---
4b6aa8
 src/lib/make_descr.c   | 20 +++++++++++++++++++-
4b6aa8
 src/lib/problem_data.c |  3 ++-
4b6aa8
 2 files changed, 21 insertions(+), 2 deletions(-)
4b6aa8
4b6aa8
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
4b6aa8
index dcf517e..2bcbebd 100644
4b6aa8
--- a/src/lib/make_descr.c
4b6aa8
+++ b/src/lib/make_descr.c
4b6aa8
@@ -119,7 +119,25 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip,
4b6aa8
             char *output = formatted ? formatted : item->content;
4b6aa8
             int pad = 16 - (strlen(key) + 2);
4b6aa8
             if (pad < 0) pad = 0;
4b6aa8
-            strbuf_append_strf(buf_dsc, "%s: %*s%s\n", key, pad, "", output);
4b6aa8
+            bool done = false;
4b6aa8
+            if (strcmp(FILENAME_REASON, key) == 0)
4b6aa8
+            {
4b6aa8
+                const char *crash_func = problem_data_get_content_or_NULL(problem_data,
4b6aa8
+                                                                          FILENAME_CRASH_FUNCTION);
4b6aa8
+                if((done = (bool)crash_func))
4b6aa8
+                    strbuf_append_strf(buf_dsc, "%s: %*s%s(): %s\n", key, pad, "", crash_func, output);
4b6aa8
+            }
4b6aa8
+            else if (strcmp(FILENAME_UID, key) == 0)
4b6aa8
+            {
4b6aa8
+                const char *username = problem_data_get_content_or_NULL(problem_data,
4b6aa8
+                                                                          FILENAME_USERNAME);
4b6aa8
+                if((done = (bool)username))
4b6aa8
+                    strbuf_append_strf(buf_dsc, "%s: %*s%s (%s)\n", key, pad, "", output, username);
4b6aa8
+            }
4b6aa8
+
4b6aa8
+            if (!done)
4b6aa8
+                strbuf_append_strf(buf_dsc, "%s: %*s%s\n", key, pad, "", output);
4b6aa8
+
4b6aa8
             empty = false;
4b6aa8
             free(formatted);
4b6aa8
         }
4b6aa8
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
4b6aa8
index 18d9541..fc07288 100644
4b6aa8
--- a/src/lib/problem_data.c
4b6aa8
+++ b/src/lib/problem_data.c
4b6aa8
@@ -450,9 +450,10 @@ void problem_data_load_from_dump_dir(problem_data_t *problem_data, struct dump_d
4b6aa8
         static const char *const list_files[] = {
4b6aa8
             FILENAME_UID       ,
4b6aa8
             FILENAME_PACKAGE   ,
4b6aa8
-            FILENAME_EXECUTABLE,
4b6aa8
+            FILENAME_CMDLINE   ,
4b6aa8
             FILENAME_TIME      ,
4b6aa8
             FILENAME_COUNT     ,
4b6aa8
+            FILENAME_REASON    ,
4b6aa8
             NULL
4b6aa8
         };
4b6aa8
         if (is_in_string_list(short_name, (char**)list_files))
4b6aa8
-- 
4b6aa8
1.8.3.1
4b6aa8