[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tru64 expr limitation
From: |
Paul Eggert |
Subject: |
Re: Tru64 expr limitation |
Date: |
Sun, 05 Mar 2006 00:32:18 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Ralf Wildenhues <address@hidden> writes:
> I'd guess you prefer the unified behavior but a bit slower everywhere
> instead, done in the patch below.
Thanks. I installed the following instead, as it avoids a couple of
fork/execs.
2006-03-05 Paul Eggert <address@hidden>
* lib/autotest/general.m4 (_AT_NORMALIZE_TEST_GROUP_NUMBER): New macro.
(AT_INIT): Use it, to remove arbitrary limit of 999,999 test
cases, and to work around Tru64 expr bug.
2006-03-05 Ralf Wildenhues <address@hidden>
* doc/autoconf.texi (Limitations of Usual Tools): Mention Tru64
expr bug that turns the result of a regex match into a number if
possible.
--- doc/autoconf.texi 22 Feb 2006 20:18:23 -0000 1.954
+++ doc/autoconf.texi 5 Mar 2006 08:27:29 -0000
@@ -12203,6 +12203,14 @@ will output @samp{a} on most hosts, but
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} incorrectly treats 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 ------------------
--- lib/autotest/general.m4 11 Jan 2006 08:33:16 -0000 1.196
+++ lib/autotest/general.m4 5 Mar 2006 08:27:29 -0000
@@ -148,6 +148,21 @@ m4_define([AT_LINE],
[m4_bpatsubst(__file__, [^\(.*/\)*\(.*\)], [[\2]]):__line__])
+# _AT_NORMALIZE_TEST_GROUP_NUMBER(SHELL-VAR)
+# ------------------------------------------
+# Normalize SHELL-VAR so that its value has the same number of digits as
+# all the other test group numbers.
+m4_define([_AT_NORMALIZE_TEST_GROUP_NUMBER],
+[
+ while :; do
+ case $$1 in #(
+ $at_format*) break;;
+ esac
+ $1=0$$1
+ done
+])
+
+
# AT_INIT([TESTSUITE-NAME])
# -------------------------
# Begin test suite.
@@ -241,10 +256,10 @@ m4_wrap([m4_divert_text([DEFAULTS],
at_tested='m4_ifdef([AT_tested], [AT_tested])'
# List of the all the test groups.
at_groups_all='AT_groups_all'
-# As many dots as there are digits in the last test group number.
+# As many question marks as there are digits in the last test group number.
# Used to normalize the test group numbers so that `ls' lists them in
# numerical order.
-at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [.])'
+at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
# Description of all the test groups.
at_help_all='AT_help_all'])])dnl
m4_divert_push([PARSE_ARGS])dnl
@@ -665,8 +680,8 @@ do
*" $at_group "* ) continue;;
esac
- # Normalize the test group number.
- at_group_normalized=`expr "00000$at_group" : ".*\($at_format\)"`
+ at_group_normalized=$at_group
+ _AT_NORMALIZE_TEST_GROUP_NUMBER(at_group_normalized)
# Create a fresh directory for the next test group, and enter.
at_group_dir=$at_suite_dir/$at_group_normalized
@@ -934,8 +949,8 @@ else
echo
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=$at_group
+ _AT_NORMALIZE_TEST_GROUP_NUMBER(at_group_normalized)
cat "$at_suite_dir/$at_group_normalized/$as_me.log"
echo
done