blob: d90486a0b276221d91a22df77d9f548313cb829b [file] [log] [blame]
JP Abgralle0ed7402014-03-19 19:08:39 -07001#!/bin/sh
2#
3# Test to see if backtrace requires a library in /usr/lib
4# Returns true if the backtrace command works and requires a library in /usr/lib
5# This is a nasty workaround for Debian bug #708307, which is really a glibc bug
6#
7
8cat > /tmp/backtrace$$.c << EOF
9
10#include <execinfo.h>
11
12int main(int argc, char **argv)
13{
14 void *stack_syms[32];
15 int frames;
16
17 frames = backtrace(stack_syms, 32);
18 backtrace_symbols_fd(stack_syms, frames, 0);
19}
20EOF
21
22if ! cc -o /tmp/backtrace$$ /tmp/backtrace$$.c; then
23 exit 1
24fi
25
26if ! ldd /tmp/backtrace$$ > /tmp/backtrace$$.ldd 2>&1 ; then
27 exit 1
28fi
29
30grep -q /usr/lib /tmp/backtrace$$.ldd
31ret=$?
32
33/bin/rm -f /tmp/backtrace$$*
34exit $ret