Menuconfig bug in pre-2.0.31

Larry M. Augustin (lma@varesearch.com)
Wed, 11 Jun 1997 17:12:26 -0700


I found another expr usage that changed and wasn't fixed in
Menuconfig. It looks like expr syntax changed from + to \+. Here's a
patch against stock 2.0.30 Menuconfig that fixes both instances of
expr that cause problems.

Larry Augustin Tl: +1.415.934.3666
VA Research, Inc. Fax: +1.415.964.7668
1235 Pear Ave., Suite 109 Email: lma@varesearch.com
Mountain View, CA 94043 Web: http://www.varesearch.com

--- /user/kernel/linux2.0.30-gcc2.7.2/linux-2.0.30/scripts/Menuconfig Tue Oct 29 07:38:17 1996
+++ Menuconfig Wed Jun 11 17:04:06 1997
@@ -21,6 +21,11 @@
#
# Please send comments / questions / bug fixes to roadcapw@cfw.com
#
+# 6/11/97 Larry Augustin (lma@varesearch.com) - integer expr test
+# fails with GNU expr 1.12. Re-write to work with new and old expr.
+# Hex expr test fails with GNU expr 1.15 and newer. Re-write to work
+# with both expr versions.
+#
#----------------------------------------------------------------------------


@@ -389,6 +394,12 @@
#
# Create a dialog for entering an integer into a kernel option.
#
+OLD_EXPR=`expr "0" : '0\?'`
+if [ $OLD_EXPR -eq 1 ]; then
+ INT_EXPR='0$\|-\?[1-9][0-9]*$'
+else
+ INT_EXPR='0$\|-?[1-9][0-9]*$'
+fi
function l_int () {
while true
do
@@ -400,7 +411,7 @@
answer="`cat MCdialog.out`"
answer="${answer:-$3}"

- if expr $answer : '0$\|-?[1-9][0-9]*$' >/dev/null
+ if expr $answer : $INT_EXPR >/dev/null
then
eval $2="$answer"
else
@@ -433,7 +444,7 @@
answer="${answer:-$3}"
answer="${answer##*[x,X]}"

- if expr $answer : '[0-9a-fA-F]+$' >/dev/null
+ if expr $answer : '[0-9a-fA-F][0-9a-fA-F]*$' >/dev/null
then
eval $2="$answer"
else