"analyzer" element name lost last shreds of sense.
We use it as a type indicator.
We can't just rename it, we need to keep compatibility.
Proposed way to do it:
For now, we fetch and look at "analyzer" element,
but we always save both "analyzer" and "type" (with same contents).
By 2013, we switch to looking at "type". Then we will stop generating
"analyzer" element sometime in the future.
--
vda
diff -x '*.po' -d -urpN libreport.5/src/include/internal_libreport.h libreport.6/src/include/internal_libreport.h
--- libreport.5/src/include/internal_libreport.h 2012-06-05 13:50:34.000000000 +0200
+++ libreport.6/src/include/internal_libreport.h 2012-06-13 14:04:19.168626063 +0200
@@ -659,7 +659,15 @@ struct dump_dir *steal_directory(const c
#define FILENAME_TIME "time" /* mandatory */
#define FILENAME_REASON "reason" /* mandatory? */
#define FILENAME_UID "uid" /* mandatory? */
+/*
+ * "analyzer" is to be gradually changed to "type":
+ * For now, we fetch and look at "analyzer" element,
+ * but we always save both "analyzer" and "type" (with same contents).
+ * By 2013, we switch to looking at "type". Then we will stop generating
+ * "analyzer" element.
+ */
#define FILENAME_ANALYZER "analyzer"
+#define FILENAME_TYPE "type"
#define FILENAME_EXECUTABLE "executable"
#define FILENAME_PID "pid"
#define FILENAME_PWD "pwd"
@@ -678,7 +686,6 @@ struct dump_dir *steal_directory(const c
// Name of the function where the application crashed.
// Optional.
#define FILENAME_CRASH_FUNCTION "crash_function"
-// filled by CDebugDump::Create() (which also fills FILENAME_UID):
#define FILENAME_ARCHITECTURE "architecture"
#define FILENAME_KERNEL "kernel"
// From /etc/system-release or /etc/redhat-release
diff -x '*.po' -d -urpN libreport.5/src/lib/make_descr.c libreport.6/src/lib/make_descr.c
--- libreport.5/src/lib/make_descr.c 2012-05-29 15:52:21.000000000 +0200
+++ libreport.6/src/lib/make_descr.c 2012-06-13 14:01:52.101689695 +0200
@@ -249,6 +249,7 @@ char* make_description_mailx(problem_dat
static const char *const blacklisted_items[] = {
CD_DUMPDIR ,
FILENAME_ANALYZER ,
+ FILENAME_TYPE ,
FILENAME_COREDUMP ,
FILENAME_HOSTNAME ,
FILENAME_DUPHASH ,
diff -x '*.po' -d -urpN libreport.5/src/lib/problem_data.c libreport.6/src/lib/problem_data.c
--- libreport.5/src/lib/problem_data.c 2012-05-29 15:52:21.000000000 +0200
+++ libreport.6/src/lib/problem_data.c 2012-06-13 14:01:27.061881339 +0200
@@ -61,7 +61,11 @@ void add_basics_to_problem_data(problem_
{
const char *analyzer = get_problem_item_content_or_NULL(pd, FILENAME_ANALYZER);
if (analyzer == NULL)
- add_to_problem_data(pd, FILENAME_ANALYZER, "libreport");
+ {
+ analyzer = "libreport";
+ add_to_problem_data(pd, FILENAME_ANALYZER, analyzer);
+ }
+ add_to_problem_data(pd, FILENAME_TYPE, analyzer);
/* If application didn't provide dupe hash, we generate it
* from all components, so we at least eliminate the exact same
@@ -104,20 +108,19 @@ void add_basics_to_problem_data(problem_
add_to_problem_data(pd, FILENAME_DUPHASH, hash_str);
}
- pid_t pid = getpid();
const char *executable = get_problem_item_content_or_NULL(pd, FILENAME_EXECUTABLE);
- if (executable == NULL && pid > 0)
+ if (executable == NULL)
{
- char buf[PATH_MAX+1];
- char *exe = xasprintf("/proc/%u/exe", pid);
+ char buf[PATH_MAX + 1];
+ char exe[sizeof("/proc/%u/exe") + sizeof(int)*3]
+ sprintf(exe, "/proc/%u/exe", (int)getpid());
ssize_t read = readlink(exe, buf, PATH_MAX);
if (read > 0)
{
- buf[read] = 0;
+ buf[read] = '\0';
VERB2 log("reporting initiated from: %s", buf);
add_to_problem_data(pd, FILENAME_EXECUTABLE, buf);
}
- free(exe);
//#ifdef WITH_RPM
/* FIXME: component should be taken from rpm using librpm