[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Tru64 expr limitation
From: |
Ralf Wildenhues |
Subject: |
Tru64 expr limitation |
Date: |
Sat, 4 Mar 2006 19:14:00 +0100 |
User-agent: |
Mutt/1.5.9i |
Tru64 UNIX 5.1 expr is a bit borked, in that it converts the result of a
regex match into a number if possible. :-(
$ expr 00001 : '.*\(...\)'
1
To see that converting is really done after matching:
$ expr x00001 : '.*\(...\)'
1
$ expr x00001 : '\(...\)'
x00
The effect in Autotest is that test directories are named
..
testsuite.dir/9
testsuite.dir/10
..
instead of the desired
..
testsuite.dir/09
testsuite.dir/10
..
I'd guess you prefer the unified behavior but a bit slower everywhere
instead, done in the patch below. OK to apply?
Cheers,
Ralf
* doc/autoconf.texi (Limitations of Usual Tools) <expr :>:
Mention Tru64 expr bug that turns the result of a regex match
into a number if possible.
* lib/autotest/general.m4 (AT_INIT): Work around it using
`echo | sed'.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.954
diff -u -r1.954 autoconf.texi
--- doc/autoconf.texi 22 Feb 2006 19:18:23 -0000 1.954
+++ doc/autoconf.texi 4 Mar 2006 17:17:26 -0000
@@ -12203,6 +12609,14 @@
simple workaround consists in testing @command{expr} and use a variable
set to @command{expr} or to @command{false} according to the result.
+Tru64 @command{expr} will treat the result as a number, if it can be
+interpreted that way:
+
address@hidden
+$ @kbd{expr 00001 : '.*\(...\)'}
+1
address@hidden example
+
@item @command{fgrep}
@c ------------------
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.196
diff -u -r1.196 general.m4
--- lib/autotest/general.m4 11 Jan 2006 08:33:16 -0000 1.196
+++ lib/autotest/general.m4 4 Mar 2006 17:17:26 -0000
@@ -666,7 +666,7 @@
esac
# Normalize the test group number.
- at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"`
+ at_group_normalized=`echo "00000$at_group" | sed
"s,.*\($at_format\),\1,"`
# Create a fresh directory for the next test group, and enter.
at_group_dir=$at_suite_dir/$at_group_normalized
@@ -935,7 +935,7 @@
for at_group in $at_fail_list
do
# Normalize the test group number and cat the log.
- at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"`
+ at_group_normalized=`echo "00000$at_group" | sed
"s,.*\($at_format\),\1,"`
cat "$at_suite_dir/$at_group_normalized/$as_me.log"
echo
done
- Tru64 expr limitation,
Ralf Wildenhues <=