--- glibc-2.5.orig/elf/ldd.bash.in +++ glibc-2.5/elf/ldd.bash.in @@ -1,4 +1,4 @@ -#! @BASH@ +#! /bin/sh # Copyright (C) 1996-2004, 2005, 2006 Free Software Foundation, Inc. # This file is part of the GNU C Library. @@ -74,6 +74,7 @@ For bug reporting instructions, please s ;; -u | --u | --un | --unu | --unus | --unuse | --unused) unused=yes + bind_now=yes shift ;; --v | --ve | --ver) @@ -107,10 +108,11 @@ if test "$unused" = yes; then fi # The following use of cat is needed to make ldd work in SELinux -# environments where the executed program might not have permissions -# to write to the console/tty. But only bash 3.x supports the pipefail -# option, and we don't bother to handle the case for older bash versions. -if set -o pipefail 2> /dev/null; then +# environments where the executed program might not have permissions to +# write to the console/tty. But only bash 3.x supports the pipefail option, +# and we don't bother to handle the case for older bash versions. +if [ "${BASH_VERSION%%.*}" -ge 3 ]; then + set -o pipefail try_trace() { eval $add_env '"$@"' | cat } @@ -151,8 +153,6 @@ for file do echo "ldd: ${file}:" $"not regular file" >&2 result=1 elif test -r "$file"; then - test -x "$file" || echo 'ldd:' $"\ -warning: you do not have execution permission for" "\`$file'" >&2 RTLD= ret=1 for rtld in ${RTLDLIST}; do @@ -165,17 +165,8 @@ warning: you do not have execution permi fi done case $ret in - 0) - # If the program exits with exit code 5, it means the process has been - # invoked with __libc_enable_secure. Fall back to running it through - # the dynamic linker. - try_trace "$file" - rc=$? - if [ $rc = 5 ]; then - try_trace "$RTLD" "$file" - rc=$? - fi - [ $rc = 0 ] || result=1 + [02]) + try_trace "$RTLD" "$file" || result=1 ;; 1) # This can be a non-ELF binary or no binary at all. @@ -184,9 +175,6 @@ warning: you do not have execution permi result=1 } ;; - 2) - try_trace "$RTLD" "$file" || result=1 - ;; *) echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($ret)" >&2 exit 1