bug-bash
[Top][All Lists]
Advanced

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

bash bug in return with minimal config


From: Simon Derr
Subject: bash bug in return with minimal config
Date: Mon, 22 Oct 2001 13:12:45 +0200 (MEST)

        Hi,

I've runned into what seems to be a bug in Gnu bash-2.05 when it is compiled
after a ./configure --enable-minimal-config on Linux. The bug does not appear if
I run configure with no options.

Here is a script that triggers it :

#!/bin/bash

runcom()
{
                /bin/echo -n "$1..." 1>&2
                shift;
                out=`"$@" 2>&1`
                ret=$?
                if [ $ret -eq 0 ]; then
                                echo OK 1>&2
                else
                                echo Failed 1>&2
                                echo "$out" 1>&2
                fi
                return $ret

}


runcom "pouet pouet" test 2 = 1
echo $?

# end of script

runcom is a function that runs a command and checks it's exit code. As you can
see here the command is test 2 = 1 and therefore will fail. runcom is supposed
to return the exit code of the command. So it should return 1 (not zero).

On a 'normal' bash the 'echo $?' will print 1, but on a minimal bash, it will
print 0. and the problem is not on the line out=`"$@" 2>&1`
since runcom will print Failed and not OK, so $ret has the right value.


I could not get bashbug to run, I'll try to give details on my system:


MACHINE="i686"
OS="linux-gnu"
CC="gcc"
CFLAGS=" -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu'
-DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H
-D_FILE_OFFSET_BITS=64  -I.  -I. -I./include -I./lib -I/usr/local/include -g
-O2"
RELEASE="2.05"
PATCHLEVEL="0"
RELSTATUS="release"
MACHTYPE="i686-pc-linux-gnu"



        Simon.



-- 
Simon Derr


address@hidden
Tel: 04 76 61 20 41
Informatique et distribution
ENSIMAG - Antenne de Montbonnot
ZIRST - 51, avenue Jean Kuntzmann
38330 MONTBONNOT SAINT MARTIN





reply via email to

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