summaryrefslogtreecommitdiffstats
path: root/debian/scripts/test-backtrace
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:26 +0000
commit668f05d989d214c0a5201bc51982e932ff15f6a3 (patch)
tree31067fca0cd63c2a0fb2bd85798e5cb2ef0dec49 /debian/scripts/test-backtrace
parentAdding upstream version 1.47.0. (diff)
downloade2fsprogs-668f05d989d214c0a5201bc51982e932ff15f6a3.tar.xz
e2fsprogs-668f05d989d214c0a5201bc51982e932ff15f6a3.zip
Adding debian version 1.47.0-2.debian/1.47.0-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/scripts/test-backtrace')
-rwxr-xr-xdebian/scripts/test-backtrace34
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/scripts/test-backtrace b/debian/scripts/test-backtrace
new file mode 100755
index 0000000..d90486a
--- /dev/null
+++ b/debian/scripts/test-backtrace
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# Test to see if backtrace requires a library in /usr/lib
+# Returns true if the backtrace command works and requires a library in /usr/lib
+# This is a nasty workaround for Debian bug #708307, which is really a glibc bug
+#
+
+cat > /tmp/backtrace$$.c << EOF
+
+#include <execinfo.h>
+
+int main(int argc, char **argv)
+{
+ void *stack_syms[32];
+ int frames;
+
+ frames = backtrace(stack_syms, 32);
+ backtrace_symbols_fd(stack_syms, frames, 0);
+}
+EOF
+
+if ! cc -o /tmp/backtrace$$ /tmp/backtrace$$.c; then
+ exit 1
+fi
+
+if ! ldd /tmp/backtrace$$ > /tmp/backtrace$$.ldd 2>&1 ; then
+ exit 1
+fi
+
+grep -q /usr/lib /tmp/backtrace$$.ldd
+ret=$?
+
+/bin/rm -f /tmp/backtrace$$*
+exit $ret