diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-06-16 16:14:40 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-06-16 17:54:39 -0400 |
commit | 3df6014a3d216d19be7d2286de24e8ee106f18ad (patch) | |
tree | 87bbe4f4fe975da41008d05dcc63befe594422a1 | |
parent | 1ad3174af5213fa7029944cc19723cda08f221d3 (diff) | |
download | android_external_e2fsprogs-3df6014a3d216d19be7d2286de24e8ee106f18ad.tar.gz android_external_e2fsprogs-3df6014a3d216d19be7d2286de24e8ee106f18ad.tar.bz2 android_external_e2fsprogs-3df6014a3d216d19be7d2286de24e8ee106f18ad.zip |
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>
-rwxr-xr-x | configure | 22 | ||||
-rw-r--r-- | configure.in | 16 | ||||
-rwxr-xr-x | debian/scripts/test-backtrace | 34 | ||||
-rw-r--r-- | e2fsck/Makefile.in | 3 | ||||
-rw-r--r-- | e2fsck/sigcatcher.c | 2 | ||||
-rw-r--r-- | lib/config.h.in | 3 |
6 files changed, 78 insertions, 2 deletions
@@ -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" diff --git a/configure.in b/configure.in index 5ca968f3..fc65b03a 100644 --- a/configure.in +++ b/configure.in @@ -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], diff --git a/debian/scripts/test-backtrace b/debian/scripts/test-backtrace new file mode 100755 index 00000000..d90486a0 --- /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 diff --git a/e2fsck/Makefile.in b/e2fsck/Makefile.in index 0c638e80..eadd5eaa 100644 --- a/e2fsck/Makefile.in +++ b/e2fsck/Makefile.in @@ -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 diff --git a/e2fsck/sigcatcher.c b/e2fsck/sigcatcher.c index 13b9bccc..e4d60ce8 100644 --- a/e2fsck/sigcatcher.c +++ b/e2fsck/sigcatcher.c @@ -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 diff --git a/lib/config.h.in b/lib/config.h.in index 0c7d8544..b500a2cb 100644 --- a/lib/config.h.in +++ b/lib/config.h.in @@ -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 |