File: test-backtrace

package info (click to toggle)
e2fsprogs 1.47.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,040 kB
  • sloc: ansic: 132,791; sh: 7,273; makefile: 5,315; awk: 524; perl: 376; cpp: 207; sed: 186; python: 23
file content (34 lines) | stat: -rwxr-xr-x 703 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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