fix reporter-bugzilla, reporter-ureport and don't autodetect executable

- Resolves: #741255
This commit is contained in:
Jakub Filak 2012-08-15 17:04:27 +02:00
parent 24c661d6a8
commit 041177be2c
4 changed files with 223 additions and 1 deletions

View File

@ -0,0 +1,60 @@
From 9eb7698dc060869cffb56039407411c8885ec3de Mon Sep 17 00:00:00 2001
From: Michal Toman <mtoman@redhat.com>
Date: Wed, 15 Aug 2012 10:15:45 +0200
Subject: [LIBREPORT PATCH 17/19] show message from the server for known
uReports
---
src/plugins/ureport.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/plugins/ureport.c b/src/plugins/ureport.c
index 5d3d5bc..3913a89 100644
--- a/src/plugins/ureport.c
+++ b/src/plugins/ureport.c
@@ -52,6 +52,7 @@ enum response_type
struct ureport_server_response {
enum response_type type;
const char *value;
+ const char *message;
};
/*
@@ -76,7 +77,12 @@ static bool ureport_server_parse_json(json_object *json, struct ureport_server_r
if (obj)
{
out_response->type = UREPORT_SERVER_RESP_KNOWN;
- out_response->value = json_object_to_json_string(obj);
+ out_response->value = json_object_get_string(obj);
+
+ json_object *message = json_object_object_get(json, "message");
+ if (message)
+ out_response->message = json_object_get_string(message);
+
return true;
}
@@ -150,6 +156,7 @@ int main(int argc, char **argv)
struct ureport_server_response response = {
.type=UREPORT_SERVER_RESP_UNKNOWN_TYPE,
.value=NULL,
+ .message=NULL,
};
const bool is_valid_response = ureport_server_parse_json(json, &response);
@@ -167,7 +174,12 @@ int main(int argc, char **argv)
ret = 0;
/* If a reported problem is not known then emit NEEDMORE */
if (strcmp("true", response.value) == 0)
+ {
+ log("This problem has already been reported.");
+ if (response.message)
+ log(response.message);
log("THANKYOU");
+ }
break;
case UREPORT_SERVER_RESP_ERROR:
VERB1 log("server side error: %s", response.value);
--
1.7.11.2

View File

@ -0,0 +1,32 @@
From dcecc5b0c7384075cdd060efbcf80157f59bd4f5 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Tue, 14 Aug 2012 16:51:35 +0200
Subject: [LIBREPORT PATCH 18/19] trac#678: reporter-bugzilla: do not attach
empty files
Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
src/plugins/rhbz.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 9c9ea34..b1c6b76 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -841,6 +841,13 @@ int rhbz_attach_files(struct abrt_xmlrpc *ax, const char *bug_id,
if (is_in_string_list(name, (char**)g_not_attached_files))
continue;
+ /* Skip empty files */
+ if (strlen(value->content) == 0)
+ {
+ log(_("Not attaching empty file '%s'"), name);
+ continue;
+ }
+
if (value->flags & CD_FLAG_TXT)
{
const char *content = value->content;
--
1.7.11.2

View File

@ -0,0 +1,117 @@
From 55af9a96d9ba4748309d0b5fb2bf6ca82b9beafd Mon Sep 17 00:00:00 2001
From: Martin Milata <mmilata@redhat.com>
Date: Mon, 13 Aug 2012 18:38:14 +0200
Subject: [LIBREPORT PATCH 19/20] rhbz#741255: don't autodetect executable for
sealert reports
- Code that adds information about current process was moved from
problem_data_add_basics to new function
problem_data_add_current_process_data.
- This change is also reflected in the python bindings (new method:
add_current_process).
- In report-python, createAlertSignature takes optional argument that
can be used to manually set the executable.
---
src/include/problem_data.h | 2 ++
src/lib/problem_data.c | 3 +++
src/report-python/__init__.py | 7 +++++--
src/report-python/problem_data.c | 17 +++++++++++++----
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/src/include/problem_data.h b/src/include/problem_data.h
index b03e272..d741b5d 100644
--- a/src/include/problem_data.h
+++ b/src/include/problem_data.h
@@ -66,6 +66,8 @@ static inline void problem_data_free(problem_data_t *problem_data)
void problem_data_add_basics(problem_data_t *pd);
+void problem_data_add_current_process_data(problem_data_t *pd);
+
void problem_data_add(problem_data_t *problem_data,
const char *name,
const char *content,
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
index 06ff3cf..724a702 100644
--- a/src/lib/problem_data.c
+++ b/src/lib/problem_data.c
@@ -107,7 +107,10 @@ void problem_data_add_basics(problem_data_t *pd)
problem_data_add_text_noteditable(pd, FILENAME_DUPHASH, hash_str);
}
+}
+void problem_data_add_current_process_data(problem_data_t *pd)
+{
const char *executable = problem_data_get_content_or_NULL(pd, FILENAME_EXECUTABLE);
if (executable == NULL)
{
diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py
index 34b1ed1..9c5e6b3 100644
--- a/src/report-python/__init__.py
+++ b/src/report-python/__init__.py
@@ -130,13 +130,15 @@ def getVersion():
return _hardcoded_default_version
-def createAlertSignature(component, hashmarkername, hashvalue, summary, alertSignature):
+def createAlertSignature(component, hashmarkername, hashvalue, summary, alertSignature, executable=None):
pd = problem_data()
pd.add("component", component)
pd.add("hashmarkername", hashmarkername)
pd.add("duphash", hashvalue)
pd.add("reason", summary)
pd.add("description", alertSignature)
+ if executable:
+ pd.add("executable", executable)
pd.add_basics()
return pd
@@ -163,7 +165,8 @@ def createPythonUnhandledExceptionSignature(**kwargs):
if (version and product):
# need to add "release", parse_release() expects format "<product> release <version>"
pd.add("os_release", product +" release "+ version)
- pd.add_basics() # adds product and version + some other required field
+ pd.add_basics() # adds required items
+ pd.add_current_proccess() # adds executable and component
return pd
diff --git a/src/report-python/problem_data.c b/src/report-python/problem_data.c
index d5e0133..666d839 100644
--- a/src/report-python/problem_data.c
+++ b/src/report-python/problem_data.c
@@ -120,6 +120,14 @@ static PyObject *p_problem_data_add_basics(PyObject *pself, PyObject *always_nul
Py_RETURN_NONE;
}
+static PyObject *p_problem_data_add_current_process(PyObject *pself, PyObject *always_null)
+{
+ p_problem_data *self = (p_problem_data*)pself;
+ problem_data_add_current_process_data(self->cd);
+
+ Py_RETURN_NONE;
+}
+
//static PyMemberDef p_problem_data_members[] = {
// { NULL }
@@ -127,10 +135,11 @@ static PyObject *p_problem_data_add_basics(PyObject *pself, PyObject *always_nul
static PyMethodDef p_problem_data_methods[] = {
/* method_name, func, flags, doc_string */
- { "add" , p_problem_data_add , METH_VARARGS },
- { "get" , p_problem_data_get_item , METH_VARARGS },
- { "create_dump_dir", p_create_dump_dir_from_problem_data, METH_VARARGS },
- { "add_basics", p_problem_data_add_basics, METH_NOARGS },
+ { "add" , p_problem_data_add , METH_VARARGS },
+ { "get" , p_problem_data_get_item , METH_VARARGS },
+ { "create_dump_dir" , p_create_dump_dir_from_problem_data, METH_VARARGS },
+ { "add_basics" , p_problem_data_add_basics , METH_NOARGS },
+ { "add_current_proccess", p_problem_data_add_current_process , METH_NOARGS },
{ NULL }
};
--
1.7.11.2

View File

@ -5,7 +5,7 @@
Summary: Generic library for reporting various problems
Name: libreport
Version: 2.0.12
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+
Group: System Environment/Libraries
URL: https://fedorahosted.org/abrt/
@ -26,6 +26,10 @@ Patch13: 0013-report-gtk-don-t-log-THANKYOU-message.patch
Patch14: 0014-trac-556-skip-not-provided-bz-bug-description-templa.patch
Patch15: 0015-rhbz-846389-generate-koops-description-according-to-.patch
Patch16: 0016-report-gtk-bug-fix-compare-ask-yes-no-dialog-respons.patch
Patch17: 0017-show-message-from-the-server-for-known-uReports.patch
Patch18: 0018-trac-678-reporter-bugzilla-do-not-attach-empty-files.patch
Patch19: 0019-rhbz-741255-don-t-autodetect-executable-for-sealert-.patch
BuildRequires: dbus-devel
BuildRequires: gtk3-devel
BuildRequires: curl-devel
@ -257,6 +261,9 @@ Plugin to report bugs into anonymous FTP site associated with ticketing system.
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%build
autoconf
@ -429,6 +436,12 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%config(noreplace) %{_sysconfdir}/libreport/events.d/uploader_event.conf
%changelog
* Wed Aug 15 2012 Jakub Filak <jfilak@redhat.com> 2.0.12-5
- rhbz#741255: don't autodetect executable for sealert reports
- show message from the server for known uReports
- trac#678: reporter-bugzilla: do not attach empty files
- Resolves: #741255
* Tue Aug 14 2012 Jakub Filak <jfilak@redhat.com> 2.0.12-4
- rhbz#846389: generate koops description according to rhbz std template
- trac#556: skip not provided bz bug description template fields