Work around Debian Bug #712530

Add a test to see if the backtrace() function requires linking in a
library in /usr/lib.

Addresses-Debian-Bug: #708307

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debian-1.42.9
Theodore Ts'o 2013-06-16 16:14:40 -04:00
parent 1ad3174af5
commit 3df6014a3d
6 changed files with 78 additions and 2 deletions

22
configure vendored
View File

@ -842,6 +842,7 @@ enable_testio_debug
enable_libuuid
enable_libblkid
enable_quota
enable_backtrace
enable_debugfs
enable_imager
enable_resizer
@ -1497,6 +1498,7 @@ Optional Features:
--disable-libuuid do not build private uuid library
--disable-libblkid do not build private blkid library
--enable-quota enable quota support
--disable-backtrace disable use backtrace
--disable-debugfs disable support of debugfs program
--disable-imager disable support of e2image program
--disable-resizer disable support of e2resize program
@ -5332,6 +5334,26 @@ DEPPROFILED_LIBQUOTA=$PROFILED_LIBQUOTA
# Check whether --enable-backtrace was given.
if test "${enable_backtrace+set}" = set; then :
enableval=$enable_backtrace; if test "$enableval" = "no"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling use of backtrace" >&5
$as_echo "Disabling use of backtrace" >&6; }
$as_echo "#define DISABLE_BACKTRACE 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling use of backtrace" >&5
$as_echo "Enabling use of backtrace" >&6; }
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling use of backtrace by default" >&5
$as_echo "Enabling use of backtrace by default" >&6; }
fi
# Check whether --enable-debugfs was given.
if test "${enable_debugfs+set}" = set; then :
enableval=$enable_debugfs; if test "$enableval" = "no"

View File

@ -596,6 +596,22 @@ AC_SUBST(PROFILED_LIBQUOTA)
AC_SUBST(DEPPROFILED_LIBQUOTA)
AC_SUBST(QUOTA_CMT)
dnl
dnl handle --disable-backtrace
dnl
AH_TEMPLATE([DISABLE_BACKTRACE], [Define to 1 to disable use of backtrace])
AC_ARG_ENABLE([backtrace],
[ --disable-backtrace disable use backtrace],
if test "$enableval" = "no"
then
AC_MSG_RESULT([Disabling use of backtrace])
AC_DEFINE(DISABLE_BACKTRACE, 1)
else
AC_MSG_RESULT([Enabling use of backtrace])
fi
,
AC_MSG_RESULT([Enabling use of backtrace by default])
)
dnl
dnl handle --enable-debugfs
dnl
AC_ARG_ENABLE([debugfs],

34
debian/scripts/test-backtrace vendored Executable file
View File

@ -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

View File

@ -143,7 +143,8 @@ crc32table.h: gen_crc32table
$(E) " GEN32TABLE $@"
$(Q) ./gen_crc32table > crc32table.h
tst_sigcatcher: $(srcdir)/sigcatcher.c
tst_sigcatcher: $(srcdir)/sigcatcher.c sigcatcher.o
$(E) " CC $@"
$(Q) $(CC) $(BUILD_LDFLAGS) $(ALL_CFLAGS) $(RDYNAMIC) \
$(srcdir)/sigcatcher.c -DDEBUG -o tst_sigcatcher

View File

@ -373,7 +373,7 @@ static void die_signal_handler(int signum, siginfo_t *siginfo,
fprintf(stderr, "fault addr=%p", siginfo->si_addr);
fprintf(stderr, "\n");
#ifdef HAVE_BACKTRACE
#if defined(HAVE_BACKTRACE) && !defined(DISABLE_BACKTRACE)
frames = backtrace(stack_syms, 32);
backtrace_symbols_fd(stack_syms, frames, 2);
#endif

View File

@ -26,6 +26,9 @@
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 1 to disable use of backtrace */
#undef DISABLE_BACKTRACE
/* Define to 1 if ext2 compression enabled */
#undef ENABLE_COMPRESSION