Glibc build failure with /bin/sh -> /bin/dash

Dan Nicholson dbn.lists at gmail.com
Wed Feb 14 19:06:26 PST 2007


On 2/14/07, George Boudreau <georgeb at linuxfromscratch.org> wrote:

> Most of the changes I made were for the pretty stuff. Dash does not have
>   'echo -e' and the 'time' function does not work like the Bash version.
> Therefore I had to force bash to be the shell.

The problem might be far simpler than it seems like. According to the
make manual, SHELL will not be inherited by sub-makes. However, if you
pass a variable in as an argument, it will be inherited by sub-makes.

jhalfs currently does a bit of magic by calling make on itself with
the SHELL=/bin/bash argument when building Ch. 5 packages. This
exports SHELL through to the glibc make command, hiding the bug.

However, if you just add "SHELL = /bin/bash" to the Makefile, it won't
be inherited by sub-makes. Here's a test case.

cat > Makefile << "EOF"
SHELL = /bin/bash
all:
        echo $$SHELL
        ./foo.sh
EOF

cat > foo.sh << "EOF"
#!/bin/bash
declare -p SHELL
make -f bar
EOF

cat > bar << "EOF"
all:
        echo $$SHELL
EOF

Now, call make with and without SHELL=/bin/bash as the argument and
see the results from sub-make executed in foo.sh (this simulates the
glibc build sort of).

[ 7:03 PM dan at conor] make
echo $SHELL
/bin/bash
./foo.sh
declare -x SHELL="/bin/bash"
make[1]: Entering directory `/home/dan/src/jhalfs'
echo $SHELL
/bin/sh
make[1]: Leaving directory `/home/dan/src/jhalfs'
[ 7:04 PM dan at conor] make SHELL=/bin/bash
echo $SHELL
/bin/bash
./foo.sh
declare -x SHELL="/bin/bash"
make[1]: Entering directory `/home/dan/src/jhalfs'
echo $SHELL
/bin/bash
make[1]: Leaving directory `/home/dan/src/jhalfs'

Only in the second case is bash being used as SHELL by the second make.

George/Manuel, is there any reason why we can't just set "SHELL =
/bin/bash" in the Makefile?

--
Dan



More information about the alfs-discuss mailing list