Re: testing Autoconf with awk

From:

Ralf Wildenhues

Subject:

Re: testing Autoconf with awk

Date:

Sat, 16 Dec 2006 16:47:40 +0100

User-agent:

Mutt/1.5.13 (2006-08-11)

* Tim Rice wrote on Fri, Dec 15, 2006 at 04:00:10AM CET:
>
> It doesn't fix the error I get when I configure without CONFIG_SHELL
> ....
> /bin/ksh ./testsuite
> /testsuite[966]: : is not an identifier
That's the error we've known for longer. It would be good to find out
the details about this shell bug. Is it only double-quoted string
literals, or also single-quoted ones that it barfs over? How high is
the boundary? 8K?
I'm really not sure if the following is more portable, even if it
happens to work on your hosts. Could you try it?
The proposed patch has the advantage that it expands to less code and
does not scale quadratically, which this code does with most shells:
at_help_all=LINE1...
at_help_all="$at_help_all
LINE2..."
...
(Note AT_help_all cannot contain a line matching ^_ATEOF$ due to the
semicolon delimiters.)
Note that this and the other proposed patch are no panacea: there are
several more places in the Autoconf code which do not limit string
literal length; it's just not overflowing for most packages. I wonder
whether we should just document "use bash" on these systems.
Cheers,
Ralf
2006-12-16 Ralf Wildenhues <address@hidden>
* lib/autotest/general.m4 (at_help_all): Initialize with a here
document rather than a shell string literal, to avoid triggering
some OpenUnix 5.0.7 ksh buffer overflow.
Report by Tim Rice.
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.218
diff -u -r1.218 general.m4
--- lib/autotest/general.m4 25 Nov 2006 09:57:34 -0000 1.218
+++ lib/autotest/general.m4 16 Dec 2006 15:45:54 -0000
@@ -278,7 +278,12 @@
# numerical order.
at_format='m4_bpatsubst(m4_defn([AT_ordinal]), [.], [?])'
# Description of all the test groups.
-at_help_all="AS_ESCAPE(m4_defn([AT_help_all]))"])])dnl
+cat > "$at_dir/$as_me$$.help" <<\_ATEOF
+AT_help_all
+_ATEOF
+at_help_all=`cat "$at_dir/$as_me$$.help"`
+rm -f "$at_dir/$as_me$$.help"
+])])dnl
m4_divert_push([PARSE_ARGS])dnl
at_prev=