diff --git a/.gitignore b/.gitignore index e69de29..623832e 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,9 @@ +/abrt-java-connector-1.0.0-239a2a6.tar.gz +/abrt-java-connector-1.0.1-6f22940.tar.gz +/abrt-java-connector-1.0.2-3cc67c2.tar.gz +/abrt-java-connector-1.0.3-872c1de.tar.gz +/abrt-java-connector-1.0.4-e97c189.tar.gz +/abrt-java-connector-1.0.5-9214372.tar.gz +/abrt-java-connector-1.0.6-befb850.tar.gz +/abrt-java-connector-1.0.7-873f82e.tar.gz +/abrt-java-connector-1.0.8-39322b0.tar.gz diff --git a/0001-Fix-a-pair-of-defects-uncovered-by-coverity.patch b/0001-Fix-a-pair-of-defects-uncovered-by-coverity.patch new file mode 100644 index 0000000..4294fa1 --- /dev/null +++ b/0001-Fix-a-pair-of-defects-uncovered-by-coverity.patch @@ -0,0 +1,51 @@ +From 54be469b8b91272e1f9852670a2f49e6bbecd0d8 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Wed, 22 Jan 2014 15:33:50 +0100 +Subject: [PATCH 1/2] Fix a pair of defects uncovered by coverity + +--- + src/abrt-checker.c | 8 ++++++-- + src/jthread_map.c | 1 + + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/abrt-checker.c b/src/abrt-checker.c +index 91485e0..713053c 100644 +--- a/src/abrt-checker.c ++++ b/src/abrt-checker.c +@@ -2886,7 +2886,11 @@ void parse_commandline_options(char *options) + } + else if (strcmp("executable", key) == 0) + { +- if (strcmp("threadclass", value) == 0) ++ if (NULL == value || '\0' == value[0]) ++ { ++ fprintf(stderr, "A value of '%s' option cannot be empty\n", key); ++ } ++ else if (strcmp("threadclass", value) == 0) + { + VERBOSE_PRINT("Use a thread class for 'executable'\n"); + executableFlags |= ABRT_EXECUTABLE_THREAD; +@@ -2899,7 +2903,7 @@ void parse_commandline_options(char *options) + } + else + { +- fprintf(stderr, "Unknown 'executable' option's value '%s'\n", key); ++ fprintf(stderr, "Unknown '%s' option's value '%s'\n", key, value); + } + } + else +diff --git a/src/jthread_map.c b/src/jthread_map.c +index 4517398..4cb417b 100644 +--- a/src/jthread_map.c ++++ b/src/jthread_map.c +@@ -55,6 +55,7 @@ T_jthreadMap *jthread_map_new() + if (NULL == map) + { + fprintf(stderr, __FILE__ ":" STRINGIZE(__LINE__) ": calloc() error\n"); ++ return NULL; + } + + pthread_mutex_init(&map->mutex, /*use default attributes*/NULL); +-- +1.8.3.1 + diff --git a/0002-Make-sure-that-agent_onload-and-agent_onunload-are-p.patch b/0002-Make-sure-that-agent_onload-and-agent_onunload-are-p.patch new file mode 100644 index 0000000..e4c5f66 --- /dev/null +++ b/0002-Make-sure-that-agent_onload-and-agent_onunload-are-p.patch @@ -0,0 +1,51 @@ +From 71ac5da86488ace3ebb3f3fa4adc747a511634e2 Mon Sep 17 00:00:00 2001 +From: Pavel Tisnovsky +Date: Mon, 3 Feb 2014 18:00:35 +0100 +Subject: [PATCH 2/2] Make sure that agent_onload and agent_onunload are + processed only once. + +--- + src/abrt-checker.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/src/abrt-checker.c b/src/abrt-checker.c +index 713053c..f142d7e 100644 +--- a/src/abrt-checker.c ++++ b/src/abrt-checker.c +@@ -2923,10 +2923,17 @@ JNIEXPORT jint JNICALL Agent_OnLoad( + char *options, + void *reserved __UNUSED_VAR) + { ++ static int already_called = 0; + jvmtiEnv *jvmti_env = NULL; + jvmtiError error_code = JVMTI_ERROR_NONE; + jint result; + ++ /* we need to make sure the agent is initialized once */ ++ if (already_called) { ++ return; ++ } ++ ++ already_called = 1; + pthread_mutex_init(&abrt_print_mutex, /*attr*/NULL); + + INFO_PRINT("Agent_OnLoad\n"); +@@ -3001,6 +3008,15 @@ JNIEXPORT jint JNICALL Agent_OnLoad( + */ + JNIEXPORT void JNICALL Agent_OnUnload(JavaVM *vm __UNUSED_VAR) + { ++ static int already_called = 0; ++ ++ /* we need to make sure the agent is initialized once */ ++ if (already_called) { ++ return; ++ } ++ ++ already_called = 1; ++ + pthread_mutex_destroy(&abrt_print_mutex); + + INFO_PRINT("Agent_OnUnLoad\n"); +-- +1.8.3.1 + diff --git a/0003-Return-the-right-constant-from-Agent_OnLoad.patch b/0003-Return-the-right-constant-from-Agent_OnLoad.patch new file mode 100644 index 0000000..874b63a --- /dev/null +++ b/0003-Return-the-right-constant-from-Agent_OnLoad.patch @@ -0,0 +1,26 @@ +From 9b09814b2a7b04105f784d7cb79836c057b92830 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Tue, 4 Feb 2014 16:37:12 +0100 +Subject: [PATCH 3/4] Return the right constant from Agent_OnLoad + +Related to rhbz#1049011 +--- + src/abrt-checker.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/abrt-checker.c b/src/abrt-checker.c +index f142d7e..e9caada 100644 +--- a/src/abrt-checker.c ++++ b/src/abrt-checker.c +@@ -2930,7 +2930,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad( + + /* we need to make sure the agent is initialized once */ + if (already_called) { +- return; ++ return JNI_OK; + } + + already_called = 1; +-- +1.8.3.1 + diff --git a/0004-Add-a-test-for-multiple-calls-of-Agent_OnLoad.patch b/0004-Add-a-test-for-multiple-calls-of-Agent_OnLoad.patch new file mode 100644 index 0000000..0e33925 --- /dev/null +++ b/0004-Add-a-test-for-multiple-calls-of-Agent_OnLoad.patch @@ -0,0 +1,54 @@ +From 3fdb3cebe489b75d23f1f21672d4aadd10471ad2 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Tue, 4 Feb 2014 16:38:02 +0100 +Subject: [PATCH 4/4] Add a test for multiple calls of Agent_OnLoad + +Related rhbz#1049011 +--- + test/CMakeLists.txt | 10 ++++++++++ + test/outputs/run_three_times.log.in | 13 +++++++++++++ + 2 files changed, 23 insertions(+) + create mode 100644 test/outputs/run_three_times.log.in + +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 0439294..5b117a1 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -317,5 +317,15 @@ _add_test(run_remote_thread 0) + _add_analyze_test(not_reportable_1remote_class) + _add_analyze_test(not_reportable_3remote_classes) + ++_add_test_target( ++ run_three_times ++ SimpleTest ++ DEPENDS ${TEST_JAVA_TARGETS} ++ AGENT_OPTIONS caught=java.lang.ArrayIndexOutOfBoundsException:java.lang.NullPointerException -agentlib=${AGENT_NAME}=output=/proc/pid/0/java.log -agentlib=${AGENT_NAME}=output=/proc/pid/1/java.log ++) ++_add_test(run_three_times 2) ++ ++ ++ + get_directory_property(all_run_targets ALL_RUN_TARGETS) + add_custom_target(run_all DEPENDS ${all_run_targets}) +diff --git a/test/outputs/run_three_times.log.in b/test/outputs/run_three_times.log.in +new file mode 100644 +index 0000000..aa8b2c8 +--- /dev/null ++++ b/test/outputs/run_three_times.log.in +@@ -0,0 +1,13 @@ ++Caught exception java.lang.ArrayIndexOutOfBoundsException in method SimpleTest.throwIndexOutOfBoundsException() ++Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 42 ++ at SimpleTest.throwIndexOutOfBoundsException(SimpleTest.java:24) [file:@CMAKE_BINARY_DIR@/test/SimpleTest.class] ++ at SimpleTest.catchIndexOutOfBoundsException(SimpleTest.java:47) [file:@CMAKE_BINARY_DIR@/test/SimpleTest.class] ++ at SimpleTest.throwAndCatchAllExceptions(SimpleTest.java:61) [file:@CMAKE_BINARY_DIR@/test/SimpleTest.class] ++ at SimpleTest.main(SimpleTest.java:81) [file:@CMAKE_BINARY_DIR@/test/SimpleTest.class] ++executable: @CMAKE_BINARY_DIR@/test/SimpleTest.class ++Uncaught exception java.lang.NullPointerException in method SimpleTest.throwNullPointerException() ++Exception in thread "main" java.lang.NullPointerException ++ at SimpleTest.throwNullPointerException(SimpleTest.java:36) [file:@CMAKE_BINARY_DIR@/test/SimpleTest.class] ++ at SimpleTest.throwAndDontCatchException(SimpleTest.java:71) [file:@CMAKE_BINARY_DIR@/test/SimpleTest.class] ++ at SimpleTest.main(SimpleTest.java:83) [file:@CMAKE_BINARY_DIR@/test/SimpleTest.class] ++executable: @CMAKE_BINARY_DIR@/test/SimpleTest.class +-- +1.8.3.1 + diff --git a/abrt-java-connector.spec b/abrt-java-connector.spec new file mode 100644 index 0000000..7b29b76 --- /dev/null +++ b/abrt-java-connector.spec @@ -0,0 +1,142 @@ +%global commit 39322b058d182855559ce0d6679e3ad5de5dc82e +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +Name: abrt-java-connector +Version: 1.0.8 +Release: 3%{?dist} +Summary: JNI Agent library converting Java exceptions to ABRT problems + +Group: System Environment/Libraries +License: GPLv2+ +URL: https://github.com/jfilak/abrt-java-connector +Source0: https://github.com/jfilak/%{name}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz + +Patch0001: 0001-Fix-a-pair-of-defects-uncovered-by-coverity.patch +Patch0002: 0002-Make-sure-that-agent_onload-and-agent_onunload-are-p.patch +Patch0003: 0003-Return-the-right-constant-from-Agent_OnLoad.patch +Patch0004: 0004-Add-a-test-for-multiple-calls-of-Agent_OnLoad.patch + +BuildRequires: cmake +BuildRequires: satyr-devel +BuildRequires: libreport-devel +BuildRequires: abrt-devel +BuildRequires: java-1.7.0-openjdk-devel +BuildRequires: systemd-devel +BuildRequires: gettext +BuildRequires: git + +Requires: abrt + +%description +JNI library providing an agent capable to process both caught and uncaught +exceptions and transform them to ABRT problems + + +%prep +%autosetup -n %{name}-%{commit} -S git + + +%build +%cmake -DCMAKE_BUILD_TYPE=Release +make %{?_smp_mflags} + + +%install +make install DESTDIR=%{buildroot} + +%files +%doc LICENSE README AUTHORS +%config(noreplace) %{_sysconfdir}/libreport/plugins/bugzilla_format_java.conf +%config(noreplace) %{_sysconfdir}/libreport/plugins/bugzilla_formatdup_java.conf +%config(noreplace) %{_sysconfdir}/libreport/events.d/java_event.conf +%{_bindir}/abrt-action-analyze-java +%{_mandir}/man1/abrt-action-analyze-java.1* +%{_mandir}/man5/java_event.conf.5* +%{_mandir}/man5/bugzilla_format_java.conf.5* +%{_mandir}/man5/bugzilla_formatdup_java.conf.5* + +# install only unversioned shared object because the package is a Java plugin +# and not a system library but unfortunately the library must be placed in ld +# library paths +%{_libdir}/lib%{name}.so + + +%check +make test + + +%post -p /sbin/ldconfig + + +%postun -p /sbin/ldconfig + + + +%changelog +* Tue Feb 04 2014 Jakub Filak - 1.0.8-3 +- Return the correct value from Agent_OnLoad +- Add test for multiple calls of Agent_On* + +* Tue Feb 04 2014 Jakub Filak - 1.0.8-2 +- Make sure that agent_onload and agent_onunload are processed only once +- Fix a pair of defects uncovered by coverity + +* Wed Jan 22 2014 Jakub Filak - 1.0.8-1 +- Do not report exceptions caught in a native method +- Mark stack traces with 3rd party classes as not-reportable +- Calculate 'duphash' & 'uuid' in satyr +- Use the main class URL for 'executable' +- Do not ship own reporting workflow definitions +- Code optimizations + +* Fri Jan 10 2014 Jakub Filak - 1.0.7-1 +- Use the last frame class path for executable +- Gracefully handle JVMTI errors +- Add an abstract to README +- Add support for journald and syslog +- Make log output disabled by default +- Add support for changing log directory +- Fix a race condition causing a crash of JVM + +* Tue Oct 01 2013 Jakub Filak - 1.0.6-1 +- Fix a deadlock in GC start callback +- Disable experimental features in production releases +- Resolves: #1012545 + +* Tue Jul 30 2013 Jakub Filak - 1.0.5-1 +- Provide a proper configuration for libreport + +* Thu Jul 18 2013 Jakub Filak - 1.0.4-1 +- Stop creating an empty log file +- Resolves: #985776 + +* Tue Jul 16 2013 Jakub Filak - 1.0.3-1 +- Fix tests on arm + +* Tue Jul 09 2013 Jakub Filak - 1.0.2-1 +- Do not crash on empty command line options + +* Mon Jul 08 2013 Jakub Filak - 1.0.1-1 +- Fix tests on ppc and s390 on both 32 and 64 bit + +* Thu Jun 27 2013 Jakub Filak - 1.0.0-1 +- Publicly releasable version + +* Mon Jun 03 2013 Jakub Filak - 0.1.2-1 +- Start versioning library +- Drop build dependency on abrt-devel + +* Mon Jun 03 2013 Jakub Filak - 0.1.1-2 +- Provide ABRT configuration + +* Mon Jun 03 2013 Jakub Filak - 0.1.1-1 +- New release + +* Fri May 31 2013 Jakub Filak - 0.1.0-3 +- Build with the library name same as the package name + +* Fri May 31 2013 Jakub Filak - 0.1.0-2 +- Build with ABRT enabled + +* Fri May 31 2013 Jakub Filak - 0.1.0-1 +- Initial version diff --git a/sources b/sources index e69de29..e0abc6a 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +5dd39a61a4775e3bea30a46968668ede abrt-java-connector-1.0.8-39322b0.tar.gz