bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble testing for bash


From: Niels Möller
Subject: Trouble testing for bash
Date: 23 Oct 2001 23:11:53 +0200

[ Sorry if you see this twice, I used the wrong bug-bash mail address
  the first time. /Niels ]

Hi, I'm having trouble checking for bash using autoconf. I have
stripped the example down to a small configure.in:

  AC_INIT([actest], [0.0], address@hidden) 
  AC_PREREQ(2.50)
  AC_CONFIG_SRCDIR([actest.c])
  AC_PATH_PROG(BASH, bash,, $PATH)
  AC_CONFIG_FILES(Makefile)
  AC_OUTPUT

I also have an empty actest.c and a Makefile.in containing the single
line

  BASH = @BASH@

I do

  autoconf && ./configure

and get

  checking for bash... /bin/sh

and a

  BASH=/bin/sh

in the generated Makefile. I'm on a linux system, where /bin/sh is a
symlink to /bin/bash. And it seems that when bash is invoked, it sets
BASH (as a shell variable, it's appearantly not exported) to the
filename that was used to invoke it. And if it's started as sh, it
sets BASH to /bin/sh:

  $ echo $BASH
  /bin/bash
  $ sh -c 'echo $BASH'
  /bin/sh

Even

  $ BASH=/bin/bash sh -c 'echo $BASH'
  /bin/sh

And /bin/sh doesn't behave at all like bash, it triggers some
compatibility mode. So BASH=/bin/sh seems pretty bogus.

I'm using "bash-2.03.0(1)-release" (which I installed from debian
stable) and autoconf-2.52, which I installed from source. uname -a
says "Linux cuckoo 2.2.19 #1 Monday Apr 2 13:29:46 EDT 2001 sparc
unknown". I also use bash as my login shell.

I'm not sure where the bug is, but it's certainly annoying. And it
took me a *long* time before I figured out how it went wrong.

I think that changing bash to *not* set BASH in its compatibility
mode, and adding some workaround in autoconf (as it will take a long
time until all bashes out there are upgraded) would improve the
situation.

/Niels



reply via email to

[Prev in Thread] Current Thread [Next in Thread]