[ABRT PATCH] provide a problem item containing versions of binaries listed in Xorg backtrace
by Jakub Filak
- because of a complaint in rhbz#867694 comment 1
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/plugins/xorg_event.conf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/plugins/xorg_event.conf b/src/plugins/xorg_event.conf
index 0effbff..4df1aaf 100644
--- a/src/plugins/xorg_event.conf
+++ b/src/plugins/xorg_event.conf
@@ -27,6 +27,9 @@ EVENT=post-create analyzer=xorg
| sha1sum | sed 's/[ \t].*//' >uuid
test -f uuid && cp uuid duphash
#
+ # Get versions of binaries listed in Xorg backtrace
+ cat backtrace | cut -f2 -d" " | xargs rpm -qf | sort -u >> backtrace_binaries_versions
+ #
test -f /var/log/Xorg.0.log && cp /var/log/Xorg.0.log .
test -f /etc/X11/xorg.conf && cp /etc/X11/xorg.conf .
test -d /etc/X11/xorg.conf.d && tar czf etc_X11_xorg_conf_d.tar.gz /etc/X11/xorg.conf.d
--
1.7.11.7
11 years, 6 months
[LIBREPORT PATCH] Update CWD after stealing of a dump directory
by Jakub Filak
- closes rhbz#869032
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/lib/steal_directory.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/lib/steal_directory.c b/src/lib/steal_directory.c
index ccfdd30..b72baa5 100644
--- a/src/lib/steal_directory.c
+++ b/src/lib/steal_directory.c
@@ -102,6 +102,16 @@ struct dump_dir *open_directory_for_writing(
if (!dd)
return NULL;
+ bool dd_was_cwd = false;
+ {
+ char old_cwd[PATH_MAX + 1];
+ /* must get CWD before deleting */
+ if (getcwd(old_cwd, sizeof(old_cwd)))
+ dd_was_cwd = strcmp(old_cwd, dump_dir_name) == 0;
+ else
+ perror_msg("getcwd()");
+ }
+
/* Delete old dir and switch to new one.
* Don't want to keep new dd open across deletion,
* therefore it's a bit more complicated.
@@ -115,5 +125,10 @@ struct dump_dir *open_directory_for_writing(
if (!dd)
xfunc_die(); /* error msg was already logged */
+ /* Update CWD to the new dump dir path if CWD is the stolen dump dir */
+ /* Nonexisting CWD breaks lot of things (i.e. gnome-open can't open URL)*/
+ if (dd_was_cwd && !chdir(dd->dd_dirname))
+ perror_msg("chdir()");
+
return dd;
}
--
1.7.11.7
11 years, 6 months
[LIBREPORT PATCH] shorten bz summary if its length exceeds 255 chars
by Jakub Filak
- cut summary on 252 characters and append "..."
- closes rhbz#867118
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/plugins/rhbz.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/src/plugins/rhbz.c b/src/plugins/rhbz.c
index 43a0fcc..c352591 100644
--- a/src/plugins/rhbz.c
+++ b/src/plugins/rhbz.c
@@ -34,6 +34,7 @@
#include <btparser/strbuf.h>
#define MAX_HOPS 5
+#define MAX_SUMMARY_LENGTH 255
//#define DEBUG
@@ -656,6 +657,45 @@ int rhbz_new_bug(struct abrt_xmlrpc *ax, problem_data_t *problem_data,
strbuf_append_strf(buf_summary, ": TAINTED %s", tainted_short);
}
+ /* If autogenerated summary is longer than max allowed summary length then
+ * try to find first ' ' from the end of acceptable long summary string
+ *
+ * If ' ' is found replace string after that by "..."
+ *
+ * If ' ' is NOT found in maximal allowed range, cut summary string on
+ * lenght (MAX_SUMMARY_LENGTH - strlen("...")) and append "..."
+ *
+ * If MAX_SUMMARY_LENGTH is 15 and max allowed cut is 5:
+ *
+ * 0123456789ABCDEF -> 0123456789AB...
+ * 0123456789 BCDEF -> 0123456789 ...
+ * 012345 789ABCDEF -> 012345 789AB...
+ */
+ if (strlen(buf_summary->buf) > MAX_SUMMARY_LENGTH)
+ {
+ char *max_end = buf_summary->buf + (MAX_SUMMARY_LENGTH - strlen("..."));
+
+ /* maximal number of characters to cut due to attempt cut summary
+ * string after last ' '
+ */
+ int max_cut = 16;
+
+ /* start looking for ' ' one char before the last possible character */
+ char *buf = max_end - 1;
+ while (buf[0] != ' ' && max_cut--)
+ --buf;
+
+ if (buf[0] != ' ')
+ buf = max_end;
+ else
+ ++buf;
+
+ buf[0] = '.';
+ buf[1] = '.';
+ buf[2] = '.';
+ buf[3] = '\0';
+ }
+
/* Generating of a description according to the RH bugzilla default format:
* https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora
*/
--
1.7.11.7
11 years, 6 months
[LIBREPORT PATCH] get product/version from system configuration
by Jakub Filak
- try to get product/version from system configuration at first attempt
- if system configuration is missing obtain product/component from
anaconda
- closes #741647
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/report-python/__init__.py | 67 +++++++++++++++++++++++++++----------------
1 file changed, 42 insertions(+), 25 deletions(-)
diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py
index 9c5e6b3..2c58736 100644
--- a/src/report-python/__init__.py
+++ b/src/report-python/__init__.py
@@ -42,10 +42,30 @@ def getProduct_fromRPM():
except:
return ""
+def getVersion_fromRPM():
+ try:
+ import rpm
+ ts = rpm.TransactionSet()
+ for each_dep in SYSTEM_RELEASE_DEPS:
+ mi = ts.dbMatch('provides', each_dep)
+ for h in mi:
+ if h['version']:
+ return str(h['version'])
+
+ return ""
+ except:
+ return ""
+"""
+
def getProduct_fromFILE():
for each_path in SYSTEM_RELEASE_PATHS:
if os.path.exists(each_path):
- file = open(each_path, "r")
+ file = None
+ try:
+ file = open(each_path, "r")
+ except IOError as e:
+ return ""
+
content = file.read()
if content.startswith("Red Hat Enterprise Linux"):
return "Red Hat Enterprise Linux"
@@ -59,24 +79,15 @@ def getProduct_fromFILE():
return ""
-def getVersion_fromRPM():
- try:
- import rpm
- ts = rpm.TransactionSet()
- for each_dep in SYSTEM_RELEASE_DEPS:
- mi = ts.dbMatch('provides', each_dep)
- for h in mi:
- if h['version']:
- return str(h['version'])
-
- return ""
- except:
- return ""
-
def getVersion_fromFILE():
for each_path in SYSTEM_RELEASE_PATHS:
if os.path.exists(each_path):
- file = open(each_path, "r")
+ file = None
+ try:
+ file = open(each_path, "r")
+ except IOError as e:
+ return ""
+
content = file.read()
if content.find("Rawhide") > -1:
return "rawhide"
@@ -86,7 +97,6 @@ def getVersion_fromFILE():
return clist[i+1]
else:
return ""
-"""
def getProduct_fromPRODUCT():
try:
@@ -112,21 +122,28 @@ def getVersion_fromPRODUCT():
def getProduct():
- """Attempt to determine the product of the running system by asking anaconda
+ """Attempt to determine the product of the running system at first attempt
+ from the release configuration file or if the first attempt fails by
+ asking anaconda
+ Always return as a string.
"""
- product = getProduct_fromPRODUCT()
- if product:
- return product
+ for getter in (getProduct_fromFILE, getProduct_fromPRODUCT):
+ product = getter()
+ if product:
+ return product
return _hardcoded_default_product
def getVersion():
- """Attempt to determine the version of the running system by asking anaconda
+ """Attempt to determine the version of the running system at first attempt
+ from the release configuration file or if the first attempt fails by
+ asking anaconda
Always return as a string.
"""
- version = getVersion_fromPRODUCT()
- if version:
- return version
+ for getter in (getVersion_fromFILE, getVersion_fromPRODUCT):
+ version = getter()
+ if version:
+ return version
return _hardcoded_default_version
--
1.7.11.7
11 years, 6 months
[LIBREPORT PATCH] add full kerneloops to the uReport
by Richard Marko
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
src/lib/json.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/lib/json.c b/src/lib/json.c
index d48e864..6fe667a 100644
--- a/src/lib/json.c
+++ b/src/lib/json.c
@@ -224,6 +224,16 @@ static void ureport_add_reporter(struct json_object *ur, const char *name, const
json_object_object_add(ur, "reporter", jobject);
}
+static void ureport_add_oops(struct json_object *ur, problem_data_t *pd)
+{
+ char *pd_item = problem_data_get_content_or_NULL(pd, FILENAME_ANALYZER);
+ if (!pd_item)
+ return;
+
+ if (!strcmp(pd_item, "Kerneloops"))
+ ureport_add_item_str(ur, pd, FILENAME_BACKTRACE, "oops");
+}
+
char *new_json_ureport(problem_data_t *pd)
{
struct json_object *ureport = json_object_new_object();
@@ -254,6 +264,8 @@ char *new_json_ureport(problem_data_t *pd)
ureport_add_core_backtrace(ureport, pd);
ureport_add_reporter(ureport, "ABRT", VERSION);
+ ureport_add_oops(ureport, pd);
+
char *j = xstrdup(json_object_to_json_string(ureport));
json_object_put(ureport);
--
1.7.11.7
11 years, 6 months