script/Configure screwed on integer param.

Philippe Strauss (philou@sicel-home-1-4.urbanet.ch)
Sun, 2 Feb 1997 13:47:04 +0100 (MET)


Until one of the latest ncrBsd ncr scsi driver, i had never
used an integer parameter for my kernel config, except for
sound, which is not revelant here.

With this ncrBsd driver, i pass two integer args, which the
configure script didnt recognize as int, but launch the help text
instead.
The culprit is in function int() of Configure:

function int () {
old=$(eval echo "\${$2}")
def=${old:-$3}
while :; do
readln "$1 ($2) [$def] " "$def" "$old"
if expr "$ans" : '0$\|-?[1-9][0-9]*$' > /dev/null; then
define_int "$2" "$ans"
break
else
help "$2"
fi
done
}

expr "$ans" : '0$\|-?[1-9][0-9]*$' always return 0 on my system,
whatever ans will be. I can't fully understand this regexp.
I can substitute it with something simpler, such as [[:digit:]]*,
though this is a leaky filter.

>From expr(1):

expr returns the following exit status:

0 if the expression is neither null nor 0,
1 if the expression is null or 0,
2 for invalid expressions.

So the help "$2" is executed, whatever i type as an argument.
My shellutils is 1.16, debian rev. 1.

I suspect a change of the regexp matching behaviour of at least expr.

Anybody has seeing this, seeing it working with older sellutils,
hints, comment?

----
Philippe Strauss, ingenieur en telecommunications.

Email: <philippe.strauss@urbanet.ch>
Homepage: http://sicel-home-1-4.urbanet.ch

"An expert is a man who has made all the mistakes, which can be made, in
a very narrow field." -- Niels Henrik David Bohr
----