Hello Ralf,
thank you for your explanation. I felt that things are getting more
compliacted than necessary, so I broke this into 6 patches.
First, I installed the following three ones (attached):
autoconf-20060522-no-labels.patch
- that `:' doesn't count as a command on the HP-UX sed
autoconf-20060522-feature-check-length.patch
- delete only the files you created, required by the AC_PROG_SED
patch, but harmless anyway
autoconf-20060522-typo.patch
- just typos
What remains from the patch that Ralf proposed in the previous mail?
The doc fixes for sed length limitations, and the AC_PROG_SED patch.
And then we have to return to the hack I proposed.
1) AC_PROG_SED patch (autoconf-20060522-prog-sed.patch)
On Mon, May 22, 2006 at 11:21:16AM +0200, Ralf Wildenhues wrote:
> [...] I think it's a good idea though (and I did do some testing
> with some system seds).
Well, I don't agree that this is a ``bugfix''. The macro searches
for a ``good sed'' and you strengthened the conditions for that.
In particular, the macro will now fail on Solaris systems without
xpg4, right? The previous version found an implementation which
worked with small scripts.
Anyway, I agree it is better to change the macro now, before it is
first published.
2) The doc fixes.
I modified the following text:
> +Solaris @command{/usr/ucb/sed} has a limit of about 6000 bytes for the
> +internal representation of the sed script, which can not be circumvented
> +using more than one script file. It fails with longer scripts, and
> +and Solaris @command{/usr/xpg4/bin/sed} dumps core with long scripts.
The first half of the second sentence still speaks about
/usr/ucb/sed, while the second half speaks about another one; yet
they are connected by a comma. I think this is unfortunate, so I
changed it this way:
``[...] more than one script file, and it fails with longer scripts.
Moreover, Solaris @command{/usr/xpg4/bin/sed} dumps core with long
scripts.''
I also shortened the description of AC_PROG_SED and AC_PROG_*GREP:
- We shall not mention that we prefer GNU sed; that may change if we
find a serious bug in certain version of it.
- We shall not mention that we look for the binaries ``on PATH'';
this is not true for AC_PROG_GREP and can change for other macros,
too.
These proposals led to autoconf-20060522-doc.patch, also attached.
3) autoconf-20060522-sed-safe.patch
(my hack, this time w/ a chlog entry)
A few comments about this trivial patch:
Ralf said, replying to my post:
> > Since most packages use only one config header, we don't have to be
> > sad that its creation has been slowed down.
>
> Agreed. But the problem is not only the config header generation. The
> config files generation suffers from the size limitation, too. Luckily,
> it seems we are generally still below the limit on that.
Of course, this is not a general solution, just a hack which fixes
most real world cases. The proposed variant is relatively weak, and
a stronger variants can be imagined:
- we could have ac_max_sed_lines=38, as in Autoconf 2.59
- we could shorten the scripts for config files (Dan Manthey's code)
by lowering _AC_SED_CMD_LIMIT, too. To make the fragments' size simiar
to what we had with 2.59, we could set it to say 45. (The previous
version had 2 commands per each substitution, that is about 50, and
then subtract another 5 to compensate for all those |#_!!_#|.)
Ralf, if you decide to strengthen the patch this way, I won't object.
I don't think it would mind if this release is slightly slower.
(And the future version will hopefully use awk. ;-)
Have a nice day,
Stepan
PS: Ufff, this was long. I know why I avoided reading the Autoconf
lists during the last few weeks. See you in June. ;-)
2006-05-21 Paul Eggert <[EMAIL PROTECTED]>
* doc/autoconf.texi (Limitations of Usual Tools) <sed>: For
the HP-UX sed limitation of 99 commands, labels do not count.
* lib/autoconf/status.m4 (_AC_SED_CMD_LIMIT): Mention that
in the comment.
(_AC_OUTPUT_HEADER): Revert the change from 2006-05-19.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1018
diff -u -r1.1018 autoconf.texi
--- doc/autoconf.texi 20 May 2006 05:39:03 -0000 1.1018
+++ doc/autoconf.texi 22 May 2006 10:18:03 -0000
@@ -13207,7 +13207,8 @@
Unicos 9 @command{sed} loops endlessly on patterns like @samp{.*\n.*}.
Sed scripts should not use branch labels longer than 8 characters and
-should not contain comments. HP-UX sed has a limit of 99 commands and
+should not contain comments. HP-UX sed has a limit of 99 commands
+(not counting @samp{:} commands) and
48 labels, which can not be circumvented by using more than one script
file. It can execute up to 19 reads with the @samp{r} command per cycle.
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.103
diff -u -r1.103 status.m4
--- lib/autoconf/status.m4 19 May 2006 21:02:10 -0000 1.103
+++ lib/autoconf/status.m4 22 May 2006 10:18:04 -0000
@@ -303,7 +303,7 @@
# _AC_SED_CMD_LIMIT
# -----------------
# Evaluate to an m4 number equal to the maximum number of commands to put
-# in any single sed program.
+# in any single sed program, not counting ":" commands.
#
# Some seds have small command number limits, like on Digital OSF/1 and HP-UX.
m4_define([_AC_SED_CMD_LIMIT],
@@ -660,7 +660,7 @@
[s,^[ #]*u.*,/* & */,]' >>conftest.defines
# Break up conftest.defines:
-ac_max_sed_lines=m4_eval(_AC_SED_CMD_LIMIT - 4)
+ac_max_sed_lines=m4_eval(_AC_SED_CMD_LIMIT - 3)
# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
2006-05-21 Ralf Wildenhues <[EMAIL PROTECTED]>
* lib/autoconf/programs.m4 (_AC_FEATURE_CHECK_LENGTH): Remove
only the files that this macro generates.
Index: lib/autoconf/programs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
retrieving revision 1.54
diff -u -r1.54 programs.m4
--- lib/autoconf/programs.m4 19 May 2006 08:11:27 -0000 1.54
+++ lib/autoconf/programs.m4 22 May 2006 10:33:21 -0000
@@ -505,7 +505,7 @@
# 10*(2^10) chars as input seems more than enough
test $ac_count -gt 10 && break
done
- rm -f conftest.*])
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out])
])
2006-05-22 Stepan Kasal <[EMAIL PROTECTED]>
* lib/autoconf/status.m4: Fix typos.
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.103
diff -u -r1.103 status.m4
--- lib/autoconf/status.m4 19 May 2006 21:02:10 -0000 1.103
+++ lib/autoconf/status.m4 22 May 2006 10:15:39 -0000
@@ -480,7 +480,7 @@
# Do the variable substitutions to create the Makefiles or whatever.
#
# This macro is expanded inside a here document. If the here document is
-# closed, it has to be reopen with "cat >>$CONFIG_STATUS <<\_ACEOF".
+# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
#
m4_define([_AC_OUTPUT_FILE],
[
@@ -594,7 +594,7 @@
# `config.h.in'.
#
# This macro is expanded inside a here document. If the here document is
-# closed, it has to be reopen with "cat >>$CONFIG_STATUS <<\_ACEOF".
+# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
#
m4_define([_AC_OUTPUT_HEADER],
[
@@ -768,7 +768,7 @@
# _AC_OUTPUT_LINK
# ---------------
# This macro is expanded inside a here document. If the here document is
-# closed, it has to be reopen with "cat >>$CONFIG_STATUS <<\_ACEOF".
+# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
m4_define([_AC_OUTPUT_LINK],
[
#
@@ -835,7 +835,7 @@
# _AC_OUTPUT_COMMAND
# ------------------
# This macro is expanded inside a here document. If the here document is
-# closed, it has to be reopen with "cat >>$CONFIG_STATUS <<\_ACEOF".
+# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
m4_define([_AC_OUTPUT_COMMAND],
[ AC_MSG_NOTICE([executing $ac_file commands])
])
@@ -1343,7 +1343,7 @@
# The main loop in $CONFIG_STATUS.
#
# This macro is expanded inside a here document. If the here document is
-# closed, it has to be reopen with "cat >>$CONFIG_STATUS <<\_ACEOF".
+# closed, it has to be reopened with "cat >>$CONFIG_STATUS <<\_ACEOF".
#
AC_DEFUN([_AC_OUTPUT_MAIN_LOOP],
[
2006-05-21 Paul Eggert <[EMAIL PROTECTED]>
and Ralf Wildenhues <[EMAIL PROTECTED]>
* lib/autoconf/programs.m4 (AC_PROG_SED): Catch script length
limits in Solaris 8 /usr/ucb/sed by testing a long script.
Index: lib/autoconf/programs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
retrieving revision 1.55
diff -u -r1.55 programs.m4
--- lib/autoconf/programs.m4 22 May 2006 10:37:15 -0000 1.55
+++ lib/autoconf/programs.m4 22 May 2006 10:55:33 -0000
@@ -812,11 +812,20 @@
# as few characters as possible. Prefer GNU sed if found.
AC_DEFUN([AC_PROG_SED],
[AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
- [_AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed],
+ [dnl ac_script should not contain more than 99 commands (for HP-UX sed),
+ dnl but more than about 7000 bytes, to catch a limit in Solaris 8
/usr/ucb/sed.
+
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" | sed 99q >conftest.sed
+ $as_unset ac_script || ac_script=
+ _AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed],
[_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED],
- ["$ac_path_SED" -e 's/a$//'])])])
+ ["$ac_path_SED" -f conftest.sed])])])
SED="$ac_cv_path_SED"
- AC_SUBST([SED])
+ AC_SUBST([SED])dnl
+ rm -f conftest.sed
])# AC_PROG_SED
2006-05-22 Paul Eggert <[EMAIL PROTECTED]>,
Ralf Wildenhues <[EMAIL PROTECTED]>,
Stepan Kasal <[EMAIL PROTECTED]>
* doc/autoconf.texi (Particular Programs): Do not promise that
we always prefer the GNU version of the program, and that we
search according to PATH; both rules can have exceptions.
Update description of AC_PROG_SED.
(Limitations of Usual Tools) <sed>: Mention script length
limitations with some of the sed implementations on Solaris.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1019
diff -u -r1.1019 autoconf.texi
--- doc/autoconf.texi 22 May 2006 10:28:34 -0000 1.1019
+++ doc/autoconf.texi 22 May 2006 11:15:20 -0000
@@ -3458,32 +3458,25 @@
@defmac AC_PROG_GREP
@acindex{PROG_GREP}
@ovindex GREP
-On AIX the default @code{grep} silently truncates long lines on the
-input before matching. On Solaris, @code{/usr/bin/grep} does not
-understand the @option{-e} option. On NeXT, @code{grep} understands only a
-single @option{-e} option. This macro looks for @sc{gnu} Grep or
-else the best available @code{grep} or @code{ggrep} in the user's
[EMAIL PROTECTED] which accepts the longest input lines possible, and which
-accepts and respects multiple @option{-e} options. Set the
-output variable @code{GREP} to whatever is chosen.
+Look for the best available @code{grep} or @code{ggrep} which accepts the
+longest input lines possible, and which handles multiple @option{-e} options.
+Set the output variable @code{GREP} to whatever is chosen.
@end defmac
@defmac AC_PROG_EGREP
@acindex{PROG_EGREP}
@ovindex EGREP
-Check whether @code{$GREP -E} works, or else search the user's
[EMAIL PROTECTED] for @code{egrep}, and @code{gegrep}, in that order, and set
-output variable @code{EGREP} to the one that accepts the longest input
-lines.
+Check whether @code{$GREP -E} works, or else search for @code{egrep}, and
[EMAIL PROTECTED], in that order, and set output variable @code{EGREP} to the
one
+that accepts the longest input lines.
@end defmac
@defmac AC_PROG_FGREP
@acindex{PROG_FGREP}
@ovindex FGREP
-Check whether @code{$GREP -F} works, or else search the user's
[EMAIL PROTECTED] for @code{fgrep}, and @code{gfgrep}, in that order, and set
-output variable @code{FGREP} to the one that accepts the longest input
-lines.
+Check whether @code{$GREP -F} works, or else search for @code{fgrep}, and
[EMAIL PROTECTED], in that order, and set output variable @code{FGREP} to the
one
+that accepts the longest input lines.
@end defmac
@defmac AC_PROG_INSTALL
@@ -3632,9 +3625,9 @@
@defmac AC_PROG_SED
@acindex{PROG_SED}
@ovindex SED
-Set output variable @code{SED} to a Sed implementation on @env{PATH} that
-truncates as few characters as possible. If @sc{gnu} Sed is found,
-use that instead.
+Set output variable @code{SED} to a Sed implementation that conforms to Posix
+and does not have arbitrary length limits. If no acceptable Sed is found, an
+error is reported.
@end defmac
@defmac AC_PROG_YACC
@@ -13211,6 +13204,10 @@
(not counting @samp{:} commands) and
48 labels, which can not be circumvented by using more than one script
file. It can execute up to 19 reads with the @samp{r} command per cycle.
+Solaris @command{/usr/ucb/sed} has a limit of about 6000 bytes for the
+internal representation of the sed script, which can not be circumvented
+using more than one script file, and it fails with longer scripts.
+Moreover, Solaris @command{/usr/xpg4/bin/sed} dumps core with long scripts.
Avoid redundant @samp{;}, as some @command{sed} implementations, such as
[EMAIL PROTECTED] 1.4.2's, incorrectly try to interpret the second
2006-05-22 Stepan Kasal <[EMAIL PROTECTED]>
* lib/autoconf/status.m4 (_AC_OUTPUT_HEADER): Set
ac_max_sed_lines=60, to work around problems with the size of
the generated sed script.
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.105
diff -u -r1.105 status.m4
--- lib/autoconf/status.m4 22 May 2006 10:40:42 -0000 1.105
+++ lib/autoconf/status.m4 22 May 2006 11:51:28 -0000
@@ -661,6 +661,9 @@
# Break up conftest.defines:
ac_max_sed_lines=m4_eval(_AC_SED_CMD_LIMIT - 3)
+# Well, to work around problems with the size of the script, use a smaller
+# limit:
+ac_max_sed_lines=60
# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"