Re: [PATCH] Newer shellutils [was: Version bug in 2.0.29?]

Philippe Strauss (philou@sicel-home-1-4.urbanet.ch)
Fri, 14 Feb 1997 11:38:39 +0100 (MET)


On Fri, 14 Feb 1997 Andries.Brouwer@cwi.nl wrote:

> H. Peter Anvin:
>
> : A worse problem is that "make oldconfig" goes into an infinite loop
> : over the sound stuff, at least in our configuration.
>
> Well, you can have /bin/expr that is a symbolic link
> either to the good old /bin/expr.old (and Linux 2.0.29 will
> compile fine, but `make oldconfig' for 2.1.26 goes into an
> infinite loop), or to the latest /bin/expr.new (and Linux 2.1.26
> will compile fine, but `make oldconfig' for 2.0.29 loops).
>
> This means that we can no longer use the old syntax,
> and cannot use the new syntax either for the sake of compatibility.
>
> Andries
>
> PS: Five years of progress:
>
> -rwxr-xr-x 1 root other 50196 Feb 11 23:41 /bin/expr.new*
> -rwxr-xr-x 1 root other 5148 Sep 5 1992 /bin/expr.old*
>

The following patch test for the shellutils version.
Work for me. It's against 2.1.26.

--- Configure.orig Fri Feb 14 11:22:33 1997
+++ Configure Fri Feb 14 11:33:44 1997
@@ -56,6 +56,16 @@
# Enable function cacheing.
set -f -h

+# Newer shellutils have a more POSIX compliant behavior which is
+# sadly not backward compatible.
+if expr "$(expr --version)" : '.*1\.1[56]' > /dev/null; then
+ INT_FILTER='0$\|-\?[1-9][0-9]*$'
+ HEX_FILTER='[0-9a-fA-F]\+$'
+else
+ INT_FILTER='0$\|-?[1-9][0-9]*$'
+ HEX_FILTER='[0-9a-fA-F]+$'
+fi
+
#
# Dummy functions for use with a config.in modified for menuconf
#
@@ -288,7 +298,7 @@
def=${old:-$3}
while :; do
readln "$1 ($2) [$def] " "$def" "$old"
- if expr "$ans" : '0$\|-\?[1-9][0-9]*$' > /dev/null; then
+ if expr "$ans" : $INT_FILTER > /dev/null; then
define_int "$2" "$ans"
break
else
@@ -319,7 +329,7 @@
while :; do
readln "$1 ($2) [$def] " "$def" "$old"
ans=${ans#*[x,X]}
- if expr "$ans" : '[0-9a-fA-F]\+$' > /dev/null; then
+ if expr "$ans" : $HEX_FILTER > /dev/null; then
define_hex "$2" "$ans"
break
else

----
Philippe Strauss, Telecom engineer.
finger philou@sicel-home-1-4.urbanet.ch for PGP key

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

"Heroism on command, senseless violence, and all the loathsome nonsense
that goes by the name of patriotism -- how passionately I hate them!"
-- Albert Einstein
----