Opened 5 years ago

Last modified 4 years ago

#23448 closed defect

configure fails when run with dash — at Version 7

Reported by: tornaria Owned by:
Priority: critical Milestone: sage-8.2
Component: build: configure Keywords: sd87
Cc: jdemeyer Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: u/tornaria/23448 (Commits, GitHub, GitLab) Commit: e77704be65648f5915df5f78573eb26fbc22cee8
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

When using an unpatched recent version of dash to run configure, this happens:

$ wget http://gondor.apana.org.au/~herbert/dash/files/dash-0.5.9.1.tar.gz
[...]
$ tar xf dash-0.5.9.1.tar.gz
$ cd dash-0.5.9.1
$ ./configure && make
[...]
$ cd ..
$ wget http://files.sagemath.org/devel/sage-8.0.rc2.tar.gz
$ tar xf sage-8.0.rc2.tar.gz
$ cd sage-8.0.rc2
$ ../dash-0.5.9.1/src/dash ./configure
$ ../dash-0.5.9.1/src/dash ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
configure: WARNING: you should use --build, --host, --target
configure: WARNING: you should use --build, --host, --target
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for root user... no
checking build system type... Invalid configuration `x': machine `x' not recognized
configure: error: bash config/config.sub x failed

My /bin/sh happens to be this shell, so just running make is broken in my system.

After much suffering, I found out the code at fault in configure.ac:

#---------------------------------------------------------
# We need to run this configure script with bash
if test -z "$BASH_VERSION$CONFIG_SHELL"
then
    CONFIG_SHELL=bash
    export CONFIG_SHELL
    if $CONFIG_SHELL -c "exit 0"
    then
        exec $CONFIG_SHELL $0 "$@"
[...]

introduced by e03f296685f986f89e1e12974f4c5ead9a9ff440.

I guess the idea is to re-run configure ($0) with the same arguments ($@) but using bash. However, by the time we reach the line exec $CONFIG_SHELL $0 "$@", the positional parameters have been obliterated by previous tests. Indeed, in the example above it happens to run bash ./configure x make which produces the error.

When using debian's dash, it turns out that before reaching this code configure decides to rerun itself and for that reason it sets CONFIG_SHELL=/bin/sh (to avoid a recursion).

Hence, the test above is wrong (IMO it should only test $BASH_VERSION).

Change History (7)

comment:1 Changed 5 years ago by tornaria

After much suffering, I found out the code at fault in configure.ac:

#---------------------------------------------------------
# We need to run this configure script with bash
if test -z "$BASH_VERSION$CONFIG_SHELL"
then
    CONFIG_SHELL=bash
    export CONFIG_SHELL
    if $CONFIG_SHELL -c "exit 0"
    then
        exec $CONFIG_SHELL $0 "$@"
[...]

introduced by e03f296685f986f89e1e12974f4c5ead9a9ff440.

I guess the idea is to re-run configure ($0) with the same arguments ($@) but using bash. However, by the time we reach the line exec $CONFIG_SHELL $0 "$@", the positional parameters have been obliterated by previous tests. Indeed, in the example above it happens to run bash ./configure x make which produces the error.

When using debian's dash, it turns out that before reaching this code configure decides to rerun itself and for that reason it sets CONFIG_SHELL=/bin/sh (to avoid a recursion).

Hence, the test above is wrong (IMO it should only test $BASH_VERSION).

comment:2 Changed 5 years ago by tornaria

  • Branch set to u/tornaria/23448
  • Commit set to 60ac90025ebfb0b4a8617922d7e09346458b103a

New commits:

60ac900(#23448) fix configure when run with dash

comment:3 Changed 5 years ago by git

  • Commit changed from 60ac90025ebfb0b4a8617922d7e09346458b103a to e77704be65648f5915df5f78573eb26fbc22cee8

Branch pushed to git repo; I updated commit sha1. New commits:

e77704b(#23448) fix configure when run with old dash

comment:4 Changed 5 years ago by tornaria

The first patch makes configure work with new versions of dash, but it breaks with old versions of dash (unpatched 0.5.6, and also version 0.5.7-4+b1 from debian jessie.

This happens because test -z "$BASH_VERSION$CONFIG_SHELL" is incorrect, it should instead be test -z "$BASH_VERSION", which is what the second patch does.

comment:5 Changed 5 years ago by tornaria

  • Status changed from new to needs_review

comment:6 Changed 5 years ago by tornaria

  • Cc jdemeyer added

comment:7 Changed 5 years ago by jdemeyer

  • Description modified (diff)
  • Status changed from needs_review to needs_info

I'm a bit lost here. I think I understood the problem, and I understand what your patch does. However, I don't see how that actually fixes the problem.

Note: See TracTickets for help on using tickets.