Here's rehash of an old patch[1] that tries to solve the problem in the subject[2]. Current sealert will produce reports with no 'executable' item using this code, and patch to sealert could make it possible to set the correct executable.
The patch splits detection of information about current process from adding basic information that are required for each report. It is potentially problematic in that it changes the libreport API in the following ways: - problem_data_add_basics no longer autodetects the executable. The only user of this function I was able to find is report-python and only one release of libreport was done after the name of this function was changed, though. - Similarly for add_basics method of the python bindings. Is this part of the API used by anything else than the create* functions in report-python? - The semantics of createPythonUnhandledExceptionSignature are preserved. Please review so that we can finally close this bug;) Martin [1] https://lists.fedorahosted.org/pipermail/crash-catcher/2011-December/002366.html [2] https://bugzilla.redhat.com/show_bug.cgi?id=741255 Note: if you pass --scissors to "git am", the line below and everything above it will be dropped from the commit message. -->8-->8-->8-->8-->8-->8-->8-->8-->8-->8-->8-- - 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 does not do the executable autodetection and takes an 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.7.6
