Compare commits

...

No commits in common. "c8s" and "c9-beta" have entirely different histories.
c8s ... c9-beta

5 changed files with 134 additions and 372 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/satyr-0.26.tar.xz
SOURCES/satyr-0.38.tar.gz

View File

@ -1 +1 @@
145348dcc67ed925c2f1b3426c994cfdddd0279a SOURCES/satyr-0.26.tar.xz
5cfe3b1158cc51d654302651adea4ee0baff82d6 SOURCES/satyr-0.38.tar.gz

View File

@ -1,262 +0,0 @@
From 0a71b956f2a778860cc35c83b051272f3f80cefc Mon Sep 17 00:00:00 2001
From: Matej Marusak <mmarusak@redhat.com>
Date: Thu, 5 Apr 2018 11:06:43 +0200
Subject: [PATCH] Anonymize paths in frames
Fixes abrt/libreport#523
Signed-off-by: Matej Marusak <mmarusak@redhat.com>
---
include/utils.h | 3 +++
lib/java_frame.c | 6 ++++++
lib/js_frame.c | 1 +
lib/normalize.c | 9 +++++++++
lib/python_frame.c | 2 ++
lib/ruby_frame.c | 2 ++
lib/utils.c | 23 +++++++++++++++++++++++
tests/java_frame.at | 12 ++++++++++++
tests/js_frame.at | 7 +++++++
tests/python/python.py | 8 ++++----
tests/python_stacktraces/python-01 | 2 +-
tests/ruby_frame.at | 2 +-
12 files changed, 71 insertions(+), 6 deletions(-)
diff --git a/include/utils.h b/include/utils.h
index 1c7984b..b36bc2c 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -406,6 +406,9 @@ sr_parse_os_release(const char *input,
void (*callback)(char*, char*, void*),
void *data);
+char*
+anonymize_path(char *file_name);
+
/**
* Demangles C++ symbol.
* @returns
diff --git a/lib/java_frame.c b/lib/java_frame.c
index 8724b64..ea407bf 100644
--- a/lib/java_frame.c
+++ b/lib/java_frame.c
@@ -468,7 +468,10 @@ const char *sr_java_frame_parse_frame_url(struct sr_java_frame *frame, const cha
sr_location_add(location, 0, sr_skip_char_cspan(&cursor, path_stop));
if (mark != cursor)
+ {
frame->class_path = sr_strndup(mark, cursor - mark);
+ frame->class_path = anonymize_path(frame->class_path);
+ }
}
if (*cursor != ']' && *cursor != '\n')
@@ -522,8 +525,11 @@ sr_java_frame_parse(const char **input,
if (sr_java_frame_parse_is_native_method(mark))
frame->is_native = true;
else if (!sr_java_frame_parse_is_unknown_source(mark))
+ {
/* DO NOT set file_name if input says that source isn't known */
frame->file_name = sr_strndup(mark, cursor - mark);
+ frame->file_name = anonymize_path(frame->file_name);
+ }
}
if (*cursor == ':')
diff --git a/lib/js_frame.c b/lib/js_frame.c
index cb29bd6..e9b6514 100644
--- a/lib/js_frame.c
+++ b/lib/js_frame.c
@@ -344,6 +344,7 @@ sr_js_frame_parse_v8(const char **input,
* ^^^^^^^^^^^^^^^^^
*/
frame->file_name = sr_strndup(local_input, token - local_input);
+ frame->file_name = anonymize_path(frame->file_name);
location->column += sr_skip_char_cspan(&local_input, "\n");
diff --git a/lib/normalize.c b/lib/normalize.c
index d23e8f5..3973b3b 100644
--- a/lib/normalize.c
+++ b/lib/normalize.c
@@ -630,6 +630,15 @@ sr_normalize_core_thread(struct sr_core_thread *thread)
frame = next_frame;
}
+ /* Anonymize file_name if contains /home/<user>/...
+ */
+ frame = thread->frames;
+ while (frame)
+ {
+ frame->file_name = anonymize_path(frame->file_name);
+ frame = frame->next;
+ }
+
/* If the first frame has address 0x0000 and its name is '??', it
* is a dereferenced null, and we remove it. This frame is not
* really invalid, but it affects stacktrace quality rating. See
diff --git a/lib/python_frame.c b/lib/python_frame.c
index 9287f3d..8453016 100644
--- a/lib/python_frame.c
+++ b/lib/python_frame.c
@@ -237,6 +237,8 @@ sr_python_frame_parse(const char **input,
frame->file_name = inside;
}
+ frame->file_name = anonymize_path(frame->file_name);
+
location->column += strlen(frame->file_name);
if (0 == sr_skip_string(&local_input, "\", line "))
diff --git a/lib/ruby_frame.c b/lib/ruby_frame.c
index 4926c63..76f17fe 100644
--- a/lib/ruby_frame.c
+++ b/lib/ruby_frame.c
@@ -258,6 +258,8 @@ sr_ruby_frame_parse(const char **input,
/* Everything before the colon is the file name. */
*p = '\0';
frame->file_name = filename_lineno_in;
+ frame->file_name = anonymize_path(frame->file_name);
+
filename_lineno_in = NULL;
if(!sr_skip_char(&local_input, '`'))
diff --git a/lib/utils.c b/lib/utils.c
index 5bbbd19..415929c 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -31,6 +31,9 @@
#include <fcntl.h>
#include <ctype.h>
+#define ANONYMIZED_PATH "/home/anonymized"
+
+
/* The prototype is in C++ header cxxabi.h, let's just copypaste it here
* instead of fiddling with include directories */
char* __cxa_demangle(const char* mangled_name, char* output_buffer,
@@ -849,3 +852,23 @@ sr_demangle_symbol(const char *sym)
return demangled;
}
+
+char*
+anonymize_path(char *orig_path)
+{
+ if (!orig_path)
+ return orig_path;
+ char* new_path = orig_path;
+ if (strncmp(orig_path, "/home/", strlen("/home/")) == 0)
+ {
+ new_path = strchr(new_path + strlen("/home/"), '/');
+ if (new_path)
+ {
+ // Join /home/anonymized/ and ^
+ new_path = sr_asprintf("%s%s", ANONYMIZED_PATH, new_path);
+ free(orig_path);
+ return new_path;
+ }
+ }
+ return orig_path;
+}
diff --git a/tests/java_frame.at b/tests/java_frame.at
index 00738be..2c6a7de 100644
--- a/tests/java_frame.at
+++ b/tests/java_frame.at
@@ -459,6 +459,18 @@ main(void)
location.column = 0;
check(c, &frame, c + strlen(c), &location);
+ /** next frame **/
+ sr_java_frame_init(&frame);
+ frame.name = sr_strdup("com.redhat.abrt.duke.nuke");
+ frame.file_name = sr_strdup("duke.java");
+ frame.class_path = sr_strdup("/home/anonymized/lib/java/foo.class");
+
+ c = " at com.redhat.abrt.duke.nuke(duke.java:-1) [file:/home/user/lib/java/foo.class]\n";
+ sr_location_init(&location);
+ location.line = 2;
+ location.column = 0;
+ check(c, &frame, c + strlen(c), &location);
+
/** next frame **/
sr_java_frame_init(&frame);
frame.name = sr_strdup("com.redhat.abrt.duke.nuke");
diff --git a/tests/js_frame.at b/tests/js_frame.at
index d17dd69..a3cc5d5 100644
--- a/tests/js_frame.at
+++ b/tests/js_frame.at
@@ -102,6 +102,13 @@ main(void)
33,
63);
+ check_valid("at ContextifyScript.Script.runInThisContext (/home/user/vm.js:25:33)",
+ "ContextifyScript.Script.runInThisContext",
+ "/home/anonymized/vm.js",
+ 25,
+ 33,
+ 74);
+
check_valid("at ContextifyScript.Script.runInThisContext (vm.js:25:33) ",
"ContextifyScript.Script.runInThisContext",
"vm.js",
diff --git a/tests/python/python.py b/tests/python/python.py
index 9044200..77a9e59 100755
--- a/tests/python/python.py
+++ b/tests/python/python.py
@@ -6,7 +6,7 @@ from test_helpers import *
path = '../python_stacktraces/python-01'
contents = load_input_contents(path)
frames_expected = 11
-expected_short_text = '''#1 _getPackage in /usr/share/PackageKit/helpers/yum/yumBackend.py:2534
+expected_short_text = '''#1 _getPackage in /home/anonymized/PackageKit/helpers/yum/yumBackend.py:2534
#2 updateProgress in /usr/share/PackageKit/helpers/yum/yumBackend.py:2593
#3 _do_start in /usr/share/PackageKit/helpers/yum/yumBackend.py:2551
#4 start in /usr/lib/python2.6/site-packages/urlgrabber/progress.py:129
@@ -76,16 +76,16 @@ class TestPythonStacktrace(BindingsTestCase):
self.assertEqual(self.trace.to_short_text(6), expected_short_text)
def test_bthash(self):
- self.assertEqual(self.trace.get_bthash(), 'fa0a7ff4b65f18661a6ce102eb787ff0d77ff12f')
+ self.assertEqual(self.trace.get_bthash(), 'eabeeae89433bb3b3d9eb8190659dcf057ab3cd1')
def test_duphash(self):
expected_plain = '''Thread
-/usr/share/PackageKit/helpers/yum/yumBackend.py:2534
+/home/anonymized/PackageKit/helpers/yum/yumBackend.py:2534
/usr/share/PackageKit/helpers/yum/yumBackend.py:2593
/usr/share/PackageKit/helpers/yum/yumBackend.py:2551
'''
self.assertEqual(self.trace.get_duphash(flags=satyr.DUPHASH_NOHASH, frames=3), expected_plain)
- self.assertEqual(self.trace.get_duphash(), '2c8e509a33966a08df1dd8b2348e850d1bc5b776')
+ self.assertEqual(self.trace.get_duphash(), '8c8273cddf94e10fc0349284afcff8970056d9e5')
def test_crash_thread(self):
self.assertTrue(self.trace.crash_thread is self.trace)
diff --git a/tests/python_stacktraces/python-01 b/tests/python_stacktraces/python-01
index 58abbfc..ae5e72c 100644
--- a/tests/python_stacktraces/python-01
+++ b/tests/python_stacktraces/python-01
@@ -19,6 +19,6 @@ Traceback (most recent call last):
self.updateProgress(name, 0.0, "", "")
File "/usr/share/PackageKit/helpers/yum/yumBackend.py", line 2593, in updateProgress
pkg = self._getPackage(name)
- File "/usr/share/PackageKit/helpers/yum/yumBackend.py", line 2534, in _getPackage
+ File "/home/user/PackageKit/helpers/yum/yumBackend.py", line 2534, in _getPackage
sections = name.rsplit('-', 2)
AttributeError: 'NoneType' object has no attribute 'rsplit'
diff --git a/tests/ruby_frame.at b/tests/ruby_frame.at
index 1b1b9d0..cef5603 100644
--- a/tests/ruby_frame.at
+++ b/tests/ruby_frame.at
@@ -38,7 +38,7 @@ main(void)
"/usr/share/ruby/vendor_ruby/will_crash.rb", 13, "func", false, 2, 1);
check("/home/u/work/will:crash/will_crash.rb:30:in `block in <class:WillClass>'",
- "/home/u/work/will:crash/will_crash.rb", 30, "class:WillClass", true, 1, 0);
+ "/home/anonymized/work/will:crash/will_crash.rb", 30, "class:WillClass", true, 1, 0);
check("./will_ruby_raise:8:in `<main>'",
"./will_ruby_raise", 8, "main", true, 0, 0);
--
2.17.1

View File

@ -1,34 +0,0 @@
From 91e3bc23a654e3daf1bf6546b06b9de7d00dbd59 Mon Sep 17 00:00:00 2001
From: Martin Kutlak <mkutlak@redhat.com>
Date: Fri, 29 Jun 2018 10:52:48 +0200
Subject: [PATCH] testsuite: Correct syntax for gdb backtrace command
The test failed on rawhide (gdb v8.1.50) with error message:
"A syntax error in expression, near `full'."
According to the GDB documentation the correct syntax for backtrace
command is `backtrace [full] n`.
- https://sourceware.org/gdb/onlinedocs/gdb/Backtrace.html
Signed-off-by: Martin Kutlak <mkutlak@redhat.com>
---
tests/core_stacktrace.at | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/core_stacktrace.at b/tests/core_stacktrace.at
index 7f6198e..13678c8 100644
--- a/tests/core_stacktrace.at
+++ b/tests/core_stacktrace.at
@@ -281,7 +281,7 @@ get_backtrace(const char *core_file, const char *executable)
args[i++] = (char*)"-ex";
args[i++] = sr_asprintf("core-file %s", core_file);
args[i++] = (char*)"-ex";
- args[i++] = (char*)"thread apply all -ascending backtrace 1024 full";
+ args[i++] = (char*)"thread apply all -ascending backtrace full 1024";
args[i++] = (char*)"-ex";
args[i++] = (char*)"info sharedlib";
args[i++] = (char*)"-ex";
--
2.17.1

View File

@ -1,5 +1,3 @@
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%if 0%{?fedora} || 0%{?rhel} > 7
# Enable python3 build by default
%bcond_without python3
@ -7,37 +5,26 @@
%bcond_with python3
%endif
%if 0%{?rhel} > 7 || 0%{?fedora} > 28
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif
%if 0%{?suse_version}
%define python2_sitearch %{python_sitearch}
%define python2_devel python-devel
%define libdw_devel libdw-devel
%define libelf_devel libelf-devel
%else
%define python2_devel python2-devel
%define libdw_devel elfutils-devel
%define libelf_devel elfutils-libelf-devel
%endif
%define glib_ver 2.43.4
Name: satyr
Version: 0.26
Release: 2%{?dist}
Version: 0.38
Release: 3%{?dist}
Summary: Tools to create anonymous, machine-friendly problem reports
License: GPLv2+
URL: https://github.com/abrt/satyr
Source0: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.xz
%if %{with python2}
BuildRequires: %{python2_devel}
%endif # with python2
Source0: https://github.com/abrt/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
%if %{with python3}
BuildRequires: python3-devel
%endif # with python3
%endif
BuildRequires: %{libdw_devel}
BuildRequires: %{libelf_devel}
BuildRequires: binutils-devel
@ -45,24 +32,18 @@ BuildRequires: rpm-devel
BuildRequires: libtool
BuildRequires: doxygen
BuildRequires: pkgconfig
BuildRequires: make
BuildRequires: automake
BuildRequires: gcc-c++
BuildRequires: gdb
%if %{with python2}
BuildRequires: python2-sphinx
%endif # with python2
BuildRequires: gperf
BuildRequires: json-c-devel
BuildRequires: glib2-devel
%if %{with python3}
BuildRequires: python3-sphinx
%endif # with python3
# git is need for '%%autosetup -S git' which automatically applies all the
# patches above. Please, be aware that the patches must be generated
# by 'git format-patch'
BuildRequires: git
Patch0001: 0001-Anonymize-paths-in-frames.patch
Patch0002: 0002-testsuite-Correct-syntax-for-gdb-backtrace-command.patch
%endif
Requires: json-c%{?_isa}
Requires: glib2%{?_isa} >= %{glib_ver}
%description
Satyr is a library that can be used to create and process microreports.
@ -80,66 +61,42 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Development libraries and headers for %{name}.
%if %{with python2}
%package -n python2-satyr
%{?python_provide:%python_provide python2-satyr}
# Remove before F30
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python < 0.24
Summary: Python bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-satyr
Python bindings for %{name}.
%endif #with python2
%if %{with python3}
%package -n python3-satyr
%{?python_provide:%python_provide python3-satyr}
# Remove before F30
Provides: %{name}-python3 = %{version}-%{release}
Provides: %{name}-python3%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python3 < 0.24
Summary: Python 3 bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python3-satyr
Python 3 bindings for %{name}.
%endif # if with python3
%endif
%prep
# http://www.rpm.org/wiki/PackagerDocs/Autosetup
# Default '__scm_apply_git' is 'git apply && git commit' but this workflow
# doesn't allow us to create a new file within a patch, so we have to use
# 'git am' (see /usr/lib/rpm/macros for more details)
%define __scm_apply_git(qp:m:) %{__git} am
%autosetup -S git
%setup -q
%build
autoreconf
%configure \
%if %{without python2}
--without-python2 \
%endif # with python2
%if %{without python3}
--without-python3 \
%endif # with python3
%{?_without_python2} \
%endif
--disable-static \
--enable-doxygen-docs
make %{?_smp_mflags}
%make_build
%install
make install DESTDIR=%{buildroot}
%make_install
# Remove all libtool archives (*.la) from modules directory.
find %{buildroot} -name "*.la" | xargs rm --
find %{buildroot} -name "*.la" -delete
%check
make check|| {
# find and print the logs of failed test
# do not cat tests/testsuite.log because it contains a lot of bloat
cat tests/test-suite.log
find tests/testsuite.dir -name "testsuite.log" -print -exec cat '{}' \;
exit 1
}
@ -152,7 +109,7 @@ make check|| {
%endif
%files
%doc README NEWS
%doc README.md NEWS
%license COPYING
%{_bindir}/satyr
%{_mandir}/man1/%{name}.1*
@ -165,13 +122,6 @@ make check|| {
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*
%if %{with python2}
%files -n python2-satyr
%dir %{python2_sitearch}/%{name}
%{python2_sitearch}/%{name}/*
%{_mandir}/man3/satyr-python.3*
%endif # with python2
%if 0%{?with_python3}
%files -n python3-satyr
%dir %{python3_sitearch}/%{name}
@ -179,10 +129,118 @@ make check|| {
%endif
%changelog
* Fri Jun 29 2018 Matej Habrnal <mhabrnal@redhat.com> 0.26-2
* Fri Dec 10 2021 Michal Fabik <mfabik@redhat.com> - 0.38-3
- Rebuild against json-c-0.14-11
Related: rhbz#2023326
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.38-2
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Jun 18 2021 Michal Fabik <mfabik@redhat.com> 0.38-1
- New upstream version
- lib: Use GLib for computing SHA-1 digests
- sr_distances_cluster_objects: Check arg safety
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.36-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.36-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jan 12 2021 Michal Fabik <mfabik@redhat.com> 0.36-1
- New upstream version
- Fix builds with python3.10
* Mon Jan 11 2021 Michal Fabik <mfabik@redhat.com> - 0.35-2
- Add fix for https://bugzilla.redhat.com/show_bug.cgi?id=1898063
* Tue Dec 01 2020 Michal Fabik <mfabik@redhat.com> 0.35-1
- New upstream version
- Fix leaks in koops stacktrace- and report-handling code
- Replace utility code with GLib functions
- Fix unit test portability issue
- Add build dependency on make
* Tue Aug 18 2020 Michal Fabik <mfabik@redhat.com> - 0.31-1
- Remove #define PyString_AsString PyUnicode_AsUTF8
- python: Adapt to changes made in PEP 590
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.30-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.30-4
- Rebuilt for Python 3.9
* Tue Apr 21 2020 Björn Esser <besser82@fedoraproject.org> - 0.30-3
- Rebuild (json-c)
* Fri Feb 07 2020 Ernestas Kulik <ekulik@redhat.com> - 0.30-2
- Bump for side tag rebuild
* Thu Feb 06 2020 Michal Fabik <mfabik@redhat.com> - 0.30-1
- Fix registers being parsed as modules in kernel oopses in some cases
- Use Nettle for cryptographic calculations
* Thu Jan 30 2020 Martin Kutlak <mkutlak@redhat.com> - 0.29-3
- Add patch to fix build failure with gcc -fno-common
- Resolves: #1796384
* Mon Nov 11 2019 Ernestas Kulik <ekulik@redhat.com> - 0.29-2
- Add patch for https://bugzilla.redhat.com/show_bug.cgi?id=1518943
* Fri Oct 11 2019 Matěj Grabovský <mgrabovs@redhat.com> 0.29-1
- spec: Switch sources tarball compression from xz to gzip
- spec: Replace xargs rm with delete
- spec: Remove provides for satyr-python3
- spec: Replace make with rpm macros
- Replace bundled JSON parser with json-c
- lib: normalize: Hash removable function names
- rpm: Fix typo in a static function name
- json: Improve error messages on EOF
- json: Use backticks consistently in error messages
- json,style: Improve code style consistency slightly
- json: Update to latest upstream version
- core: Document unknown core frame address
- style: Correct parenthesization for bitfield tests
- style: Use specific integer types instead of the generic int
- style: Use *_MAX constants instead of -1 in unsigned comparisons
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0.28-4
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.28-3
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.28-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Jun 21 2019 Ernestas Kulik <ekulik@redhat.com> - 0.28-1
- New version 0.28
* Mon Jun 10 22:13:23 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.27-4
- Rebuild for RPM 4.15
* Mon Jun 10 15:42:05 CET 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.27-3
- Rebuild for RPM 4.15
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.27-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Oct 8 2018 Martin Kutlak <mkutlak@redhat.com> 0.27-1
- New upstream version
- Improve format of truncated backtrace for Python and core
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.26-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Jun 29 2018 Matej Habrnal <mhabrnal@redhat.com> 0.26-3
- Anonymize paths in frames
- Test fix: correct syntax for gdb backtrace command
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.26-2
- Rebuilt for Python 3.7
* Tue Apr 17 2018 Matej Habrnal <mhabrnal@redhat.com> 0.26-1
- spec: fix Allow python2 to be optional at build time
- Allow python2 to be optional at build time