[PATCH-libreport] report-python: don't include executable
by Martin Milata
Doesn't really make sense, as it is always path to the python
executable. bz#741255
---
src/include/problem_data.h | 3 +++
src/lib/problem_data.c | 5 +++++
src/report-python/problem_data.c | 8 ++++++++
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/include/problem_data.h b/src/include/problem_data.h
index 14d1240..87037a2 100644
--- a/src/include/problem_data.h
+++ b/src/include/problem_data.h
@@ -74,6 +74,9 @@ void add_to_problem_data(problem_data_t *problem_data,
const char *name,
const char *content);
+/* Removes item from problem data */
+void remove_from_problem_data(problem_data_t *problem_data, const char *key);
+
static inline struct problem_item *get_problem_data_item_or_NULL(problem_data_t *problem_data, const char *key)
{
return (struct problem_item *)g_hash_table_lookup(problem_data, key);
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
index 2ddff86..7d85709 100644
--- a/src/lib/problem_data.c
+++ b/src/lib/problem_data.c
@@ -155,6 +155,11 @@ void add_to_problem_data(problem_data_t *problem_data,
add_to_problem_data_ext(problem_data, name, content, CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE);
}
+void remove_from_problem_data(problem_data_t *problem_data, const char *key)
+{
+ g_hash_table_remove(problem_data, key);
+}
+
const char *get_problem_item_content_or_die(problem_data_t *problem_data, const char *key)
{
struct problem_item *item = get_problem_data_item_or_NULL(problem_data, key);
diff --git a/src/report-python/problem_data.c b/src/report-python/problem_data.c
index 9067dea..8b4088d 100644
--- a/src/report-python/problem_data.c
+++ b/src/report-python/problem_data.c
@@ -115,8 +115,16 @@ static PyObject *p_create_dump_dir_from_problem_data(PyObject *pself, PyObject *
static PyObject *p_add_basics_to_problem_data(PyObject *pself, PyObject *always_null)
{
p_problem_data *self = (p_problem_data*)pself;
+ int have_executable = (get_problem_data_item_or_NULL(self->cd, "executable") != NULL);
+
add_basics_to_problem_data(self->cd);
+ /* Workaround - the executable item will always be /usr/bin/python, which is useless. */
+ if (!have_executable)
+ {
+ remove_from_problem_data(self->cd, "executable");
+ }
+
Py_RETURN_NONE;
}
--
1.7.6.4
12 years, 1 month
[PATCH] add dedup-client to abrt
by Michal Toman
Two patches:
01 splits HTTPS util funcs to a separate file.
02 adds the dedup-client.
You can test the dedup client on the 10.34.24.254 machine (I'm not sure
how the public one works, there are some issues with older python in RHEL6)
abrt-dedup-client <component> <backtrace_file> -k --url=10.34.24.254
Example:
abrt-dedup-client coreutils ~/crashes/sleep/backtrace -k --url=10.34.24.254
Run-tested, please review.
Michal
12 years, 2 months
Question about abrt-action-install-debuginfo-to-abrt-cache
by Chris Meek
Hi,
I little while ago I worked on a feature for systemtap where we could use
abrt-action-install-debuginfo-to-abrt-cache to automatically download the
required debuginfo to run a given script, by providing the build ID. I
came across a couple bugs, specifically:
https://bugzilla.redhat.com/show_bug.cgi?id=730107
https://bugzilla.redhat.com/show_bug.cgi?id=726192
These appear to have been fixed, so I was planning on testing them out.
I noticed, after upgrading to the most recent ABRT, that
abrt-action-install-debuginfo-to-abrt-cache was moved to /usr/libexec/
from /usr/bin/.
I was just wondering if this should work the same way as before, or is
it meant to be executed indirectly though something else in /usr/bin/ ?
Thanks,
Chris
12 years, 3 months
[PATCH] when we load text elements, sanitize also control chars
by Denys Vlasenko
Intended to fix this:
rhbz#625485 - XML report generated by report lib from within Anaconda is not valid XML
Basically, it was caused by backspace char in the text file.
With this patch, backspace would be replaced by "[08]"
--
vda
diff -x '*.po' -d -urpN libreport.6/src/include/internal_libreport.h libreport.7/src/include/internal_libreport.h
--- libreport.6/src/include/internal_libreport.h 2012-01-13 16:42:25.000000000 +0100
+++ libreport.7/src/include/internal_libreport.h 2012-01-17 20:37:00.944296029 +0100
@@ -156,9 +156,18 @@ ssize_t full_write_str(int fd, const cha
#define encode_base64 libreport_encode_base64
char *encode_base64(const void *src, int length);
-/* Returns NULL if the string needs no sanitizing. */
+/* Returns NULL if the string needs no sanitizing.
+ * control_chars_to_sanitize is a bit mask.
+ * If Nth bit is set, Nth control char will be sanitized (replaced by [XX]).
+ */
#define sanitize_utf8 libreport_sanitize_utf8
-char *sanitize_utf8(const char *src);
+char *sanitize_utf8(const char *src, uint32_t control_chars_to_sanitize);
+enum {
+ SANITIZE_ALL = 0xffffffff,
+ SANITIZE_TAB = (1 << 9),
+ SANITIZE_LF = (1 << 10),
+ SANITIZE_CR = (1 << 13),
+};
#define SHA1_RESULT_LEN (5 * 4)
typedef struct sha1_ctx_t {
diff -x '*.po' -d -urpN libreport.6/src/lib/abrt_dbus.c libreport.7/src/lib/abrt_dbus.c
--- libreport.6/src/lib/abrt_dbus.c 2012-01-13 16:41:45.000000000 +0100
+++ libreport.7/src/lib/abrt_dbus.c 2012-01-17 20:30:02.705986106 +0100
@@ -58,7 +58,7 @@ void store_string(DBusMessageIter* iter,
/* dbus daemon will simply close our connection if we send broken utf8.
* Therefore we must never do that.
*/
- const char *sanitized = sanitize_utf8(val);
+ const char *sanitized = sanitize_utf8(val, /*ctrl:*/ 0);
if (!dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, sanitized ? &sanitized : &val))
die_out_of_memory();
free((char*)sanitized);
diff -x '*.po' -d -urpN libreport.6/src/lib/problem_data.c libreport.7/src/lib/problem_data.c
--- libreport.6/src/lib/problem_data.c 2012-01-17 20:28:10.258740549 +0100
+++ libreport.7/src/lib/problem_data.c 2012-01-17 20:39:06.927519682 +0100
@@ -345,8 +345,12 @@ void load_problem_data_from_dump_dir(pro
if (nl && nl[1] == '\0')
*nl = '\0';
- /* Sanitize possibly corrupted utf8 */
- char *sanitized = sanitize_utf8(content);
+ /* Sanitize possibly corrupted utf8.
+ * Of control chars, allow only tab and newline.
+ */
+ char *sanitized = sanitize_utf8(content,
+ (SANITIZE_ALL & ~SANITIZE_LF & ~SANITIZE_TAB)
+ );
if (sanitized)
{
free(content);
diff -x '*.po' -d -urpN libreport.6/src/lib/utf8.c libreport.7/src/lib/utf8.c
--- libreport.6/src/lib/utf8.c 2012-01-13 16:41:45.000000000 +0100
+++ libreport.7/src/lib/utf8.c 2012-01-17 20:35:36.372825763 +0100
@@ -18,7 +18,7 @@
*/
#include "internal_libreport.h"
-char *sanitize_utf8(const char *src)
+char *sanitize_utf8(const char *src, uint32_t control_chars_to_sanitize)
{
const char *initial_src = src;
char *sanitized = NULL;
@@ -31,6 +31,8 @@ char *sanitize_utf8(const char *src)
unsigned c = (unsigned char) *src;
if (c <= 0x7f)
{
+ if (c < 32 && (((uint32_t)1 << c) & control_chars_to_sanitize))
+ goto bad_byte;
bytes = 1;
goto good_byte;
}
12 years, 3 months
[RFC patchset] new abrt-server.c capable of saving more information
by Vratislav Podzimek
First of all -- this set of patches is really meant as a request for comments to the way
how it is dealing with parsing socket communication and saving additional data. I didn't
try to compile it and I know that it needs a little bit of 'rebase-magic' to be compilable
after applying single patches one after another.
Just please have a look at the way of the message parsing, value checking and saving and
let me know if you see any problems in it. I will take it into account, write a new version
of these patches (this time properly rebased and tested) and send it again here.
--
Vratislav Podzimek
12 years, 3 months
[PATCH] replace start_with by quicker prefixcmp
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/daemon/abrt-server.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/daemon/abrt-server.c b/src/daemon/abrt-server.c
index 42ab34b..55dd3b8 100644
--- a/src/daemon/abrt-server.c
+++ b/src/daemon/abrt-server.c
@@ -162,19 +162,13 @@ static int create_debug_dump()
return 201; /* Created */
}
-/* Checks if a string has certain prefix. */
-static bool starts_with(const char *str, const char *start)
-{
- return strncmp(str, start, strlen(start)) == 0;
-}
-
/* Remove dump dir */
static int delete_path(const char *dump_dir_name)
{
/* If doesn't start with "g_settings_dump_location/"... */
char *dump_location = xasprintf("%s/", g_settings_dump_location);
log("%s", dump_location);
- if (!starts_with(dump_dir_name, dump_location)
+ if (prefixcmp(dump_dir_name, dump_location)
/* or contains "/." anywhere (-> might contain ".." component) */
|| strstr(dump_dir_name + strlen(g_settings_dump_location), "/.")
) {
@@ -238,7 +232,7 @@ static char *try_to_get_string(const char *message,
bool printable,
bool allow_slashes)
{
- if (!starts_with(message, tag))
+ if (prefixcmp(message, tag))
return NULL;
const char *contents = message + strlen(tag);
@@ -295,7 +289,7 @@ static void process_message(const char *message)
#undef HANDLE_INCOMING_STRING
/* PID is not handled as a string, we convert it to pid_t. */
- if (starts_with(message, "PID="))
+ if (!prefixcmp(message, "PID="))
{
pid = xatou(message + strlen("PID="));
if (pid < 1)
--
1.7.8
12 years, 3 months