summaryrefslogtreecommitdiffstats
path: root/lib/Utils/make_descr.cpp
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-11-20 12:22:36 +0100
committerKarel Klic <kklic@redhat.com>2009-11-20 12:22:36 +0100
commit18363807e6ffa8dab5a76f40bacac3695985147a (patch)
tree8195336c29136a4761db501160c9f4620b16aa70 /lib/Utils/make_descr.cpp
parentbd60681c8227bc31ef0991e98a9a3e849032c924 (diff)
parent6ec2390e40ba4b0f6e10a2c8ce858d3431b34964 (diff)
downloadabrt-18363807e6ffa8dab5a76f40bacac3695985147a.tar.gz
abrt-18363807e6ffa8dab5a76f40bacac3695985147a.tar.xz
abrt-18363807e6ffa8dab5a76f40bacac3695985147a.zip
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/Utils/make_descr.cpp')
-rw-r--r--lib/Utils/make_descr.cpp85
1 files changed, 82 insertions, 3 deletions
diff --git a/lib/Utils/make_descr.cpp b/lib/Utils/make_descr.cpp
index 0c09614..c4cc3f3 100644
--- a/lib/Utils/make_descr.cpp
+++ b/lib/Utils/make_descr.cpp
@@ -2,6 +2,15 @@
//#include "abrt_types.h"
#include "CrashTypes.h"
#include "DebugDump.h" /* FILENAME_ARCHITECTURE etc */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(S) gettext(S)
+#else
+# define _(S) (S)
+#endif
using namespace std;
@@ -42,6 +51,9 @@ 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
+
string make_description_bz(const map_crash_report_t& pCrashReport)
{
string description;
@@ -68,8 +80,9 @@ string make_description_bz(const map_crash_report_t& pCrashReport)
const string &filename = it->first;
const string &type = it->second[CD_TYPE];
const string &content = it->second[CD_CONTENT];
- if (type == CD_TXT)
- {
+ if (type == CD_TXT
+ || (type == CD_ATT && content.size() < INLINE_TEXT_ATT_SIZE)
+ ) {
if (filename != CD_UUID
&& filename != FILENAME_ARCHITECTURE
&& filename != FILENAME_RELEASE
@@ -78,8 +91,9 @@ string make_description_bz(const map_crash_report_t& pCrashReport)
) {
add_content(was_multiline, description, filename.c_str(), content.c_str());
}
+ continue;
}
- else if (type == CD_ATT)
+ if (type == CD_ATT)
{
add_content(was_multiline, description, "Attached file", filename.c_str());
}
@@ -131,3 +145,68 @@ string make_description_logger(const map_crash_report_t& pCrashReport)
return description;
}
+
+/* This needs more work to make the result less ugly */
+string make_description_catcut(const map_crash_report_t& pCrashReport)
+{
+ map_crash_report_t::const_iterator end = pCrashReport.end();
+ map_crash_report_t::const_iterator it;
+
+ string howToReproduce;
+ it = pCrashReport.find(CD_REPRODUCE);
+ if (it != end)
+ {
+ howToReproduce = "\n\nHow to reproduce\n"
+ "-----\n";
+ howToReproduce += it->second[CD_CONTENT];
+ }
+ string comment;
+ it = pCrashReport.find(CD_COMMENT);
+ if (it != end)
+ {
+ comment = "\n\nComment\n"
+ "-----\n";
+ comment += it->second[CD_CONTENT];
+ }
+
+ string pDescription = "\nabrt "VERSION" detected a crash.\n";
+ pDescription += howToReproduce;
+ pDescription += comment;
+ pDescription += "\n\nAdditional information\n"
+ "======\n";
+
+ for (it = pCrashReport.begin(); it != end; it++)
+ {
+ const string &filename = it->first;
+ const string &type = it->second[CD_TYPE];
+ const string &content = it->second[CD_CONTENT];
+ if (type == CD_TXT)
+ {
+ if (filename != CD_UUID
+ && filename != FILENAME_ARCHITECTURE
+ && filename != FILENAME_RELEASE
+ && filename != CD_REPRODUCE
+ && filename != CD_COMMENT
+ ) {
+ pDescription += '\n';
+ pDescription += filename;
+ pDescription += "\n-----\n";
+ pDescription += content;
+ pDescription += "\n\n";
+ }
+ }
+ else if (type == CD_ATT)
+ {
+ pDescription += "\n\nAttached files\n"
+ "----\n";
+ pDescription += filename;
+ pDescription += '\n';
+ }
+ else if (type == CD_BIN)
+ {
+ error_msg(_("Binary file %s will not be reported"), filename.c_str());
+ }
+ }
+
+ return pDescription;
+}