Following along with the POSIXification of 2007, I noticed that ldd is
a bash script and will fail silently for non-bash /bin/sh.

[12:25 PM [EMAIL PROTECTED] bash /usr/bin/ldd /lib/libc.so.6
        /lib/ld-linux.so.2 (0xb7f2b000)
        linux-gate.so.1 =>  (0xb7f2a000)
[12:25 PM [EMAIL PROTECTED] dash /usr/bin/ldd /lib/libc.so.6
[12:26 PM [EMAIL PROTECTED] echo $?
2

The Glibc Makefile tries to be smart and substitutes in the value for
$(BASH) in elf/ldd.in. The value for BASH is figured out in configure
using the standard autoconf macro AC_PATH_PROG. It will do a PATH
search for bash unless the variable $BASH is set in the environment,
indicating that the user wants to override the location.

When we run ./configure in Ch. 6, /bin/sh is executed, which is a link
to bash. This sets BASH=/bin/sh in the environment, so that gets
recorded by AC_PATH_PROG and subsequently substituted in /usr/bin/ldd
for the shebang (run head -n1 /usr/bin/ldd). You can see this happen
if /bin/sh -> bash on your system:

$ /bin/sh -c "declare -p BASH"
declare -- BASH="/bin/sh"
$ /bin/bash -c "declare -p BASH"
declare -- BASH="/bin/bash"

This isn't a problem if /bin/sh -> bash always. But if you later
install a new sh, ldd will bomb. So, I'm proposing that we force
/bin/bash as the shebang for ldd. Two possible ways are:

1. Prior to configure and changing dirs - sed -i 's|@BASH@|/bin/bash|'
elf/ldd.in
2. Just override the var during make - make BASH=/bin/bash

What do you guys think?

--
Dan
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to