[PATCH] dbus api and policyKit support
by Jiri Moskovcak
Please checkout the polkit3 branch it should be the latest master with
my patches on top of it. I will merge it when the review is done.
Thank you,
Jirka
12 years, 2 months
[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, 2 months
new dbus service + polkit branch
by Jiri Moskovcak
Hi,
I decided to publish my work on the polkit feature in the separate git
branch, so everyone can check it out, test and comment since the early
stages.
Further design note:
There was an idea some time ago that we would provide a generic dbus API
other application can use to to query the problem database. To make it
more neutral I would like to change the service dbus name from
com.redhat.abrt to org.freedesktop.Problems or something like that
(waiting for ideas).
$ git clone git://git.fedorahosted.org/git/abrt.git
$ cd abrt
$ git --trac origin/polkit
$ ./autogen && ./configure && make rpm
--Jirka
12 years, 2 months
[PATCH v3] Fix uploaded crash directory being marked as duplicate
by Richard Marko
Fixes rhbz#800828, trac#476
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
src/daemon/abrtd.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index 3189b5c..b664d54 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -353,10 +353,16 @@ static mw_result_t
run_post_create_and_load_data(const char *dump_dir_name, prob
/* Update count */
char *count_str = dd_load_text_ext(dd, FILENAME_COUNT,
DD_FAIL_QUIETLY_ENOENT);
unsigned long count = strtoul(count_str, NULL, 10);
- count++;
- char new_count_str[sizeof(long)*3 + 2];
- sprintf(new_count_str, "%lu", count);
- dd_save_text(dd, FILENAME_COUNT, new_count_str);
+
+ /* Don't increase crash count if we are working with newly uploaded
+ * directory (remote crash) which already has it's crash count set.
+ */
+ if((status != 0 && dup_of_dir) || count == 0) {
+ count++;
+ char new_count_str[sizeof(long)*3 + 2];
+ sprintf(new_count_str, "%lu", count);
+ dd_save_text(dd, FILENAME_COUNT, new_count_str);
+ }
dd_close(dd);
*problem_data = load_problem_data(dump_dir_name);
--
1.7.7.6
12 years, 2 months
[PATCH] handle-event: fix blaming dump-dir its self as duplicate
by Nikola Pajkovsky
all it was happened only due to trailing '/'
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/daemon/abrt-handle-event.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/daemon/abrt-handle-event.c b/src/daemon/abrt-handle-event.c
index 5d22cf0..58c4a84 100644
--- a/src/daemon/abrt-handle-event.c
+++ b/src/daemon/abrt-handle-event.c
@@ -424,10 +424,15 @@ int main(int argc, char **argv)
load_abrt_conf();
bool post_create = (strcmp(event_name, "post-create") == 0);
- const char *dump_dir_name = NULL;
+ char *dump_dir_name = NULL;
while (*argv)
{
- dump_dir_name = *argv++;
+ dump_dir_name = xstrdup(*argv++);
+ int i = strlen(dump_dir_name);
+ while (--i >= 0)
+ if (dump_dir_name[i] != '/')
+ break;
+ dump_dir_name[++i] = '\0';
struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
if (!dd)
--
1.7.9.2.384.g4a92a
12 years, 2 months
[PATCH v2] Fix uploaded crash directory being marked as duplicate
by Richard Marko
Fixes Bug 800828 - Upload directory feature does not work correctly
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
src/daemon/abrtd.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index 3189b5c..6478201 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -353,10 +353,16 @@ static mw_result_t
run_post_create_and_load_data(const char *dump_dir_name, prob
/* Update count */
char *count_str = dd_load_text_ext(dd, FILENAME_COUNT,
DD_FAIL_QUIETLY_ENOENT);
unsigned long count = strtoul(count_str, NULL, 10);
- count++;
- char new_count_str[sizeof(long)*3 + 2];
- sprintf(new_count_str, "%lu", count);
- dd_save_text(dd, FILENAME_COUNT, new_count_str);
+
+ /* Don't increase crash count if we are working with newly uploaded
+ * directory (remote crash) which already has it's crash count set.
+ */
+ if(status != 0 || count == 0) {
+ count++;
+ char new_count_str[sizeof(long)*3 + 2];
+ sprintf(new_count_str, "%lu", count);
+ dd_save_text(dd, FILENAME_COUNT, new_count_str);
+ }
dd_close(dd);
*problem_data = load_problem_data(dump_dir_name);
--
1.7.7.6
12 years, 2 months
[PATCH] Fix uploaded crash directory being marked as duplicate
by Richard Marko
Fixes Bug 800828 - Upload directory feature does not work correctly
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
src/daemon/abrtd.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index 3189b5c..ad6474d 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -353,10 +353,16 @@ static mw_result_t
run_post_create_and_load_data(const char *dump_dir_name, prob
/* Update count */
char *count_str = dd_load_text_ext(dd, FILENAME_COUNT,
DD_FAIL_QUIETLY_ENOENT);
unsigned long count = strtoul(count_str, NULL, 10);
- count++;
- char new_count_str[sizeof(long)*3 + 2];
- sprintf(new_count_str, "%lu", count);
- dd_save_text(dd, FILENAME_COUNT, new_count_str);
+
+ /* Don't increase crash count if we are working with newly uploaded
+ * directory (remote crash) which already has it's crash count set.
+ */
+ if(status != 0) {
+ count++;
+ char new_count_str[sizeof(long)*3 + 2];
+ sprintf(new_count_str, "%lu", count);
+ dd_save_text(dd, FILENAME_COUNT, new_count_str);
+ }
dd_close(dd);
*problem_data = load_problem_data(dump_dir_name);
--
1.7.7.6
12 years, 2 months
[PATCH] Fix uploaded crash directory being marked as duplicate
by Richard Marko
From: Richard Marko <rmarko(a)redhat.com>
Fixes Bug 800828 - Upload directory feature does not work correctly
---
src/daemon/abrtd.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index 3189b5c..ad6474d 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -353,10 +353,16 @@ static mw_result_t run_post_create_and_load_data(const char *dump_dir_name, prob
/* Update count */
char *count_str = dd_load_text_ext(dd, FILENAME_COUNT, DD_FAIL_QUIETLY_ENOENT);
unsigned long count = strtoul(count_str, NULL, 10);
- count++;
- char new_count_str[sizeof(long)*3 + 2];
- sprintf(new_count_str, "%lu", count);
- dd_save_text(dd, FILENAME_COUNT, new_count_str);
+
+ /* Don't increase crash count if we are working with newly uploaded
+ * directory (remote crash) which already has it's crash count set.
+ */
+ if(status != 0) {
+ count++;
+ char new_count_str[sizeof(long)*3 + 2];
+ sprintf(new_count_str, "%lu", count);
+ dd_save_text(dd, FILENAME_COUNT, new_count_str);
+ }
dd_close(dd);
*problem_data = load_problem_data(dump_dir_name);
--
1.7.7.6
12 years, 2 months
[PATCH] bugzilla: use deduplication information for determining bug-id
by Nikola Pajkovsky
Deduplication client stores information into <dump-dir> into *remote_result* file.
*Remote_result* file contains only one line in format DUPLICATE <bug-id> for now.
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/plugins/reporter-bugzilla.c | 119 +++++++++++++++++++++++++--------------
src/plugins/rhbz.h | 5 +-
2 files changed, 81 insertions(+), 43 deletions(-)
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 825c92a..7c7472e 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -280,57 +280,92 @@ int main(int argc, char **argv)
parse_release_for_bz(rhbz.b_release, &rhbz.b_product, &version);
free(version);
- log(_("Checking for duplicates"));
+ const char *filnam_remote_result;
+ filnam_remote_result = get_problem_item_content_or_NULL(problem_data, FILENAME_REMOTE_RESULT);
+ if (filnam_remote_result)
+ {
+ char *remote_result = xstrdup(filnam_remote_result);
+ if (remote_result[strlen(remote_result) - 1] == '\n')
+ remote_result[strlen(remote_result) - 1] = '\0';
+
+ char *cmd = strtok(remote_result, " ");
+ char *id = strtok(NULL, " ");
+
+ if (!prefixcmp(cmd, "DUPLICATE"))
+ {
+ int old_errno = errno;
+ errno = 0;
+ char *e;
+ rhbz.b_id = strtoul(id, &e, 10);
+ if (errno || id == e || *e != '\0' || rhbz.b_id > INT_MAX)
+ {
+ /* error / no digits / illegal trailing chars */
+ errno = old_errno;
+ rhbz.b_id = 0;
+ }
+ errno = old_errno; /* Ok. So restore errno. */
+ }
+ }
- /*
- selinux guy's almost always move filled bug from component selinux-policy
- to right component.
+ struct bug_info *bz = NULL;
+ if (!rhbz.b_id)
+ {
+ log(_("Checking for duplicates"));
+
+ /*
+ selinux guy's almost always move filled bug from component selinux-policy
+ to right component.
- bugzilla client is looking for duplicate bug by sending xmlrpc query
+ bugzilla client is looking for duplicate bug by sending xmlrpc query
- "ALL whiteboard:<hash> product:<product> component:<name>"
+ "ALL whiteboard:<hash> product:<product> component:<name>"
- so if bug is moved from component selinux-policy to other, then query
- returns NULL and creates a new bug.
- */
- const char *component_substitute = (!strcmp(component, "selinux-policy")) ? NULL : component;
- xmlrpc_value *result = rhbz_search_duphash(client, component_substitute,
- rhbz.b_product, duphash);
+ so if bug is moved from component selinux-policy to other, then query
+ returns NULL and creates a new bug.
+ */
+ const char *component_substitute = (!strcmp(component, "selinux-policy")) ? NULL : component;
+ xmlrpc_value *result = rhbz_search_duphash(client, component_substitute,
+ rhbz.b_product, duphash);
- xmlrpc_value *all_bugs = rhbz_get_member("bugs", result);
- xmlrpc_DECREF(result);
- if (!all_bugs)
- error_msg_and_die(_("Missing mandatory member 'bugs'"));
+ xmlrpc_value *all_bugs = rhbz_get_member("bugs", result);
+ xmlrpc_DECREF(result);
+ if (!all_bugs)
+ error_msg_and_die(_("Missing mandatory member 'bugs'"));
- int all_bugs_size = rhbz_array_size(all_bugs);
- // When someone clones bug it has same duphash, so we can find more than 1.
- // Need to be checked if component is same.
- VERB3 log("Bugzilla has %i reports with same duphash '%s'",
- all_bugs_size, duphash);
+ int all_bugs_size = rhbz_array_size(all_bugs);
+ // When someone clones bug it has same duphash, so we can find more than 1.
+ // Need to be checked if component is same.
+ VERB3 log("Bugzilla has %i reports with same duphash '%s'",
+ all_bugs_size, duphash);
- int bug_id = rhbz_bug_id(all_bugs);
- xmlrpc_DECREF(all_bugs);
- struct bug_info *bz = rhbz_bug_info(client, bug_id);
+ int bug_id = rhbz_bug_id(all_bugs);
+ xmlrpc_DECREF(all_bugs);
+ bz = rhbz_bug_info(client, bug_id);
- if (all_bugs_size == 0)
+ if (all_bugs_size == 0)
+ {
+ /* Create new bug */
+ log(_("Creating a new bug"));
+ bug_id = rhbz_new_bug(client, problem_data, rhbz.b_release);
+
+ log(_("Adding attachments to bug %i"), bug_id);
+ char bug_id_str[sizeof(int)*3 + 2];
+ sprintf(bug_id_str, "%i", bug_id);
+
+ int flags = RHBZ_NOMAIL_NOTIFY;
+ if (opts & OPT_b)
+ flags |= RHBZ_ATTACH_BINARY_FILES;
+ rhbz_attach_big_files(client, bug_id_str, problem_data, flags);
+
+ bz = new_bug_info();
+ bz->bi_status = xstrdup("NEW");
+ bz->bi_id = bug_id;
+ goto log_out;
+ }
+ }
+ else
{
- /* Create new bug */
- log(_("Creating a new bug"));
- bug_id = rhbz_new_bug(client, problem_data, rhbz.b_release);
-
- log(_("Adding attachments to bug %i"), bug_id);
- char bug_id_str[sizeof(int)*3 + 2];
- sprintf(bug_id_str, "%i", bug_id);
-
- int flags = RHBZ_NOMAIL_NOTIFY;
- if (opts & OPT_b)
- flags |= RHBZ_ATTACH_BINARY_FILES;
- rhbz_attach_big_files(client, bug_id_str, problem_data, flags);
-
- bz = new_bug_info();
- bz->bi_status = xstrdup("NEW");
- bz->bi_id = bug_id;
- goto log_out;
+ bz = rhbz_bug_info(client, rhbz.b_id);
}
log(_("Bug is already reported: %i"), bz->bi_id);
diff --git a/src/plugins/rhbz.h b/src/plugins/rhbz.h
index 979cef2..c9023e9 100644
--- a/src/plugins/rhbz.h
+++ b/src/plugins/rhbz.h
@@ -61,6 +61,7 @@ struct bug_info {
};
struct bugzilla_struct {
+ int b_id;
const char *b_login;
const char *b_password;
const char *b_bugzilla_xmlrpc;
@@ -71,7 +72,9 @@ struct bugzilla_struct {
};
#define INIT_BUGZILLA(name) \
- static struct bugzilla_struct name
+ static struct bugzilla_struct name = { \
+ .b_id = 0, \
+ }
struct bug_info *new_bug_info();
void free_bug_info(struct bug_info *bz);
--
1.7.9.2.384.g4a92a
12 years, 2 months