[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: status.m4 off-by-one
From: |
Ralf Wildenhues |
Subject: |
Re: status.m4 off-by-one |
Date: |
Tue, 8 Nov 2005 17:20:08 +0100 |
User-agent: |
Mutt/1.5.11 |
[ I've Cc:ed Dan as the author of this ]
Sorry for answering myself all the time.
* Ralf Wildenhues wrote on Tue, Nov 08, 2005 at 12:59:45PM CET:
>
> It's an off-by-one in status.m4, I just don't know where.
> Has nothing to do with Libtool.
>
> I can reproduce it with
[ see shell script below, with N=59 ]
Hacky workaround for this issue included in the patch below. This
should be fixed right instead, but I'm not _quite_ sure how.
The following is a brute force script to find this and other stuff.
If you change AC_SUBST to AC_SUBST_FILE, it hits other errors: One
line wasn't properly escaped. It was output if a certain limit of
AC_SUBST_FILE invocations is encountered. Then, a macro wasn't
properly escaped, which led to a m4 error.
#!/bin/sh
set -e -u
N=1
while test $N -le 1000; do
echo $N
(
echo AC_INIT
i=1
while test $i -le $N; do
echo "AC_SUBST([a$i])"
i=`expr $i + 1`
done
echo '
AC_CONFIG_FILES([Makefile])
AC_OUTPUT'
) > configure.ac
touch Makefile.in
autoconf
./configure
N=`expr $N + 1`
done
Cheers,
Ralf
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE):
Fix quoting of output line (triggered for many AC_SUBST_FILEs).
Fix macro quoting. Fix output for n*100 substituted variables.
--- lib/autoconf/status.m4 2005-11-08 10:08:58.000000000 +0100
+++ lib/autoconf/status.m4 2005-11-08 17:00:24.000000000 +0100
@@ -351,9 +351,9 @@
m4_define([_AC_SED_CMDS],
m4_defn([_AC_SED_CMDS])[| sed -f "$tmp/subs-]_AC_SED_FRAG_NUM[.sed" ])dnl
[cat >>$CONFIG_STATUS <<_ACEOF
-cat >"$tmp/subs-]_AC_SED_FRAG_NUM[.sed" <\CEOF
+cat >"\$tmp/subs-]_AC_SED_FRAG_NUM[.sed" <<\CEOF
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-]m4_defn(_AC_SED_FRAG)dnl
+]m4_defn([_AC_SED_FRAG])dnl
[CEOF
_ACEOF
@@ -398,8 +399,8 @@
m4_define([_AC_SED_DELIM_NUM], m4_incr(_AC_SED_DELIM_NUM))dnl
_AC_Var!$_AC_Var$ac_delim
])dnl
m4_if(_AC_SED_CMD_LIMIT,
- m4_if(_AC_Var, address@hidden@], _AC_SED_CMD_LIMIT, _AC_SED_CMD_NUM),
+ m4_if(_AC_Var, address@hidden@], m4_if(_AC_SED_CMD_NUM, 2, 2,
_AC_SED_CMD_LIMIT), _AC_SED_CMD_NUM),
[_ACEOF
if test `grep -c "$ac_delim\$" conf$$subs.sed` = _AC_SED_DELIM_NUM; then