]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use setrlimit instead of ulimit -c in backtrace tests
authorrl1987 <rl1987@sdf.lonestar.org>
Wed, 13 Feb 2019 13:50:09 +0000 (15:50 +0200)
committerDavid Goulet <dgoulet@torproject.org>
Wed, 20 Feb 2019 17:06:26 +0000 (12:06 -0500)
changes/bug29061 [new file with mode: 0644]
src/test/test_bt.sh
src/test/test_bt_cl.c

diff --git a/changes/bug29061 b/changes/bug29061
new file mode 100644 (file)
index 0000000..58fc4f2
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes (testing):
+    - Call setrlimit() to disable core dumps in test_bt_cl.c instead of
+      using `ulimit -c` in test_bt.sh, which violates POSIX shell
+      compatibility. Fixes bug 29061; bugfix on 0.3.5.1-alpha.
index df8bcb8eda82a2f3fba08f6b5e7c06ca52fc6839..312905a4e2460af427282f0dc2ea843b0f07829b 100755 (executable)
@@ -3,8 +3,6 @@
 
 exitcode=0
 
-ulimit -c 0
-
 export ASAN_OPTIONS="handle_segv=0:allow_user_segv_handler=1"
 "${builddir:-.}/src/test/test-bt-cl" backtraces || exit $?
 "${builddir:-.}/src/test/test-bt-cl" assert 2>&1 | "${PYTHON:-python}" "${abs_top_srcdir:-.}/src/test/bt_test.py" || exitcode="$?"
index 0c15a02ee48afd5b5ea381ef7fbf11cf32efce04..08b08ba4236edf1fbadbd5fdf033d447bc5e06ff 100644 (file)
@@ -4,6 +4,9 @@
 #include "orconfig.h"
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
 
 /* To prevent 'assert' from going away. */
 #undef TOR_COVERAGE
@@ -88,6 +91,11 @@ main(int argc, char **argv)
     return 1;
   }
 
+#ifdef HAVE_SYS_RESOURCE_H
+  struct rlimit rlim = { .rlim_cur = 0, .rlim_max = 0 };
+  setrlimit(RLIMIT_CORE, &rlim);
+#endif
+
 #if !(defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \
    defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION))
     puts("Backtrace reporting is not supported on this platform");