This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Shell scripts requiring bash


Hi!

There are several occasions during glibc build (well, most notably during
testing) where it is assumed that /bin/sh is bash.  If it is not, this
can be worked around by passing SHELL=/bin/bash on the make command lines
(it is not enough to pass it once when configuring, as with other GNU
toolchain packages).

The issue is: even though the shell scripts contain #!/bin/bash as their
hashbang, they're still invoked with $(SHELL) [...] from the Makefiles.
On the other hand, there already is some bash detection magic in
configure.in.

What's the way forward?  Should we use something like $(BASH) [...] for
invoking these scripts?  Should $(SHELL) be set to /bin/bash (instead of
/bin/sh) if that's available?  Should the scripts be directly invoked
From the Makefiles (not through $(SHELL); a few need to get Git
executable attributes), then the hashbang would do the right thing?


With /bin/sh being dash, the following compares a pristine run to one
with SHELL=/bin/bash passed.


    -/bin/sh -e tst-fmon.sh [...]
    +/bin/bash -e tst-fmon.sh [...]
              > /home/thomas/tmp/source/glibc/glibc.build/localedata/tst-fmon.out
    -make[2]: *** [/home/thomas/tmp/source/glibc/glibc.build/localedata/tst-fmon.out] Error 1
    
    diff -ru glibc.build.dash.pristine/localedata/tst-fmon.out glibc.build.pristine/localedata/tst-fmon.out
    --- glibc.build.dash.pristine/localedata/tst-fmon.out   2012-03-19 13:09:00.705749298 +0100
    +++ glibc.build.pristine/localedata/tst-fmon.out        2012-03-19 15:37:50.670156869 +0100
    @@ -1,54 +0,0 @@
    -Locale: "de_DE.ISO-8859-1" Format: "%n" Value: "1.23" Received: "1,23 EUR" Expected: " 1,23 EUR" => false
    -Locale: "de_DE.ISO-8859-1" Format: "%n" Value: "-1.23" Received: "-1,23 EUR" Expected: "       -1,23 EUR" => false
    -Locale: "de_DE.ISO-8859-1" Format: "%n" Value: "1234.56" Received: "1.234,56 EUR" Expected: "  1.234,56 EUR" => false
    -Locale: "de_DE.ISO-8859-1" Format: "%12n" Value: "123.45" Received: "  123,45 EUR" Expected: "   123,45 EUR" => false
    -[...]

This looks strange -- dash appears to be eating space characters?  Might
be a shell programming or a dash issues; not yet investiaged.


     gcc -U_FORTIFY_SOURCE -fno-stack-protector -nostdlib -nostartfiles -o /home/thomas/tmp/source/glibc/glibc.build/localedata/tst-rpmatch [...]
    +/bin/bash -e tst-rpmatch.sh [...]

Very strange: this test is actually only run if SHELL=/bin/bash is passed
(reproduced twice).  I cannot explain this from a quick glance at
localedata/Makefile.


    -/bin/sh -e tst-tls6.sh /home/thomas/tmp/source/glibc/glibc.build/ /home/thomas/tmp/source/glibc/glibc.build/elf/ \
    +/bin/bash -e tst-tls6.sh /home/thomas/tmp/source/glibc/glibc.build/ /home/thomas/tmp/source/glibc/glibc.build/elf/ \
                        ld-linux-x86-64.so.2
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{a,b,c,d}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{b,a,c,d}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{b,c,d,a}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{e,b,c,d}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{b,e,c,d}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{b,c,d,e}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{f,b,c,d}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{b,f,c,d}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{b,c,d,f}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{d,a,b,c,e}.so' from LD_PRELOAD cannot be preloaded: ignored.
    -ERROR: ld.so: object '/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mod{d,a,b,e,f}.so' from LD_PRELOAD cannot be preloaded: ignored.
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5modd.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5modd.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5moda.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5modd.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5modd.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mode.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5modd.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5modd.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5modf.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5mode.so: undefined symbol: tls_registry
    +/home/thomas/tmp/source/glibc/glibc.build//nptl/tst-tls5: symbol lookup error: /home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls5modf.so: undefined symbol: tls_registry
    +make[2]: *** [/home/thomas/tmp/source/glibc/glibc.build/nptl/tst-tls6.out] Error 1

Diff of tst-tls6.out:

    diff -ru glibc.build.dash.pristine/nptl/tst-tls6.out glibc.build.pristine/nptl/tst-tls6.out
    --- glibc.build.dash.pristine/nptl/tst-tls6.out 2012-03-19 13:17:36.385772834 +0100
    +++ glibc.build.pristine/nptl/tst-tls6.out      2012-03-19 15:46:33.598180736 +0100
    @@ -1,44 +1,33 @@
     preload tst-tls5mod{a,b,c,d}.so
     ===============
    -pthread_self () = 0x2b4580410700, size 2304, align 64
     
     preload tst-tls5mod{b,a,c,d}.so
     ===============
    -pthread_self () = 0x2b54fc25b700, size 2304, align 64
     
    [...]

This test gives different errors with dash vs. bash (not yet investigated
whether any of these are expected).  In the bash case the test invocation
actually fails, in the dash case it succeeds.


    -/bin/sh -e run-conformtest.sh /home/thomas/tmp/source/glibc/glibc.build/conform/ /usr/bin/perl 'gcc -U_FORTIFY_SOURCE -fno-stack-protector' \
    +/bin/bash -e run-conformtest.sh /home/thomas/tmp/source/glibc/glibc.build/conform/ /usr/bin/perl 'gcc -U_FORTIFY_SOURCE -fno-stack-protector' \
              '-I../include -I/home/thomas/tmp/source/glibc/glibc.build -I../sysdeps/x86_64/elf -I../nptl/sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/wordsize-64 -I../nptl/sysdeps/unix/sys
    -run-conformtest.sh: 8: Syntax error: "(" unexpected
    -make[2]: [/home/thomas/tmp/source/glibc/glibc.build/conform/run-conformtest.out] Error 2 (ignored)
    +ISO...
    +ISO99...
    +[...]
    +make[2]: [/home/thomas/tmp/source/glibc/glibc.build/conform/run-conformtest.out] Error 1 (ignored)

run-conformtest.sh uses arrays, and thus fails if invoked with dash.


    -/bin/sh -e ../sysdeps/x86_64/tst-xmmymm.sh /home/thomas/tmp/source/glibc/glibc.build/elf/ > /home/thomas/tmp/source/glibc/glibc.build/elf/tst-xmmymm.out
    -../sysdeps/x86_64/tst-xmmymm.sh: 18: declare: not found
    -make[2]: *** [/home/thomas/tmp/source/glibc/glibc.build/elf/tst-xmmymm.out] Error 127
    +/bin/bash -e ../sysdeps/x86_64/tst-xmmymm.sh /home/thomas/tmp/source/glibc/glibc.build/elf/ > /home/thomas/tmp/source/glibc/glibc.build/elf/tst-xmmymm.out

Again arrays.


GrÃÃe,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]