autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1.10a instspc.test failure


From: Ralf Wildenhues
Subject: Re: 1.10a instspc.test failure
Date: Thu, 18 Jan 2007 22:03:00 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

* quoting myself from Tue, Jan 16, 2007 at 07:49:12PM CET:
>
> Fine with me.  I have a patch cooking to fix carriage return.  But to
> fix non-ASCII, I think gawk needs a patch, too...

Hmm.  Seems my editor outsmarted me there by munging the test file.
Sorry about the premature accusations against gawk.

Here's a new patch.  Note that it deliberately kills carriage return at
the line ending in order to prevent bogus extra backslashes there, in
the event that some text mode caused them there before (not observed in
tests).  The late munging of the substitution script is due to the fact
that awk features are only tested at config.status time.

Tested on several unices.  Confirmed that it fixes the Automake
instspc.test failure on OpenBSD (so I guess NetBSD will be fine, too).
It also seems to work flawlessly on Cygwin (binmode mount tested only).

On MinGW, there are two problems: First, curiously gawk fails to cope
with 0xff:

$ echo @zardoz@ | awk -f confLB2136/subs.awk >out
gawk: confLB2136/subs.awk:45: "?????????????"
gawk: confLB2136/subs.awk:45: ^ unterminated string

(sorry, the cut and paste output is seriously damaged; the string is
much longer).

But what's more, the shell kills a literal carriage return from a
here document, i.e.,
  cat <<EOF
  a
b
  EOF

outputs `ab' (same with \EOF).  That means the carriage return will
never make it into the awk script, with the current config.status setup;
I don't see how to fix this.

WDYT?  Below is what I have now, without taking MinGW into account.

Cheers,
Ralf

2007-01-17  Ralf Wildenhues  <address@hidden>

        * doc/autoconf.texi (Setting Output Variables): Mention that
        all non-NUL characters are ok in substituted values.
        * lib/autoconf/status.m4 (_AC_SED_CMD_LIMIT): Fix comment typo.
        (_AC_OUTPUT_FILES_PREPARE): Test and use backslash escaping of
        carriage return for $AWK, needed for BSD awk.
        * tests/torture.at (Substitute and define special characters):
        Test all 8 bit non-NUL characters.
        Report against Automake by Patrick Welche.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1126
diff -u -r1.1126 autoconf.texi
--- doc/autoconf.texi   16 Jan 2007 16:22:04 -0000      1.1126
+++ doc/autoconf.texi   18 Jan 2007 20:53:09 -0000
@@ -8354,7 +8354,8 @@
 or more makefiles).  This means that @code{AC_OUTPUT}
 replaces instances of @samp{@@@var{variable}@@} in input files with the
 value that the shell variable @var{variable} has when @code{AC_OUTPUT}
-is called.  The value can contain newlines.
+is called.  The value can contain any address@hidden character, including
+newline.
 Variable occurrences should not overlap: e.g., an input file should
 not contain @samp{@@@var{var1}@@@var{var2}@@} if @var{var1} and @var{var2}
 are variable names.
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.126
diff -u -r1.126 status.m4
--- lib/autoconf/status.m4      28 Dec 2006 23:20:18 -0000      1.126
+++ lib/autoconf/status.m4      18 Jan 2007 20:53:09 -0000
@@ -313,7 +313,7 @@
 
 # _AC_AWK_LITERAL_LIMIT
 # ---------------------
-# Evaluate the maximum number of characters to put in an awk
+# Evaluate to the maximum number of characters to put in an awk
 # string literal, not counting escape characters.
 #
 # Some awk's have small limits, such as Solaris and AIX awk.
@@ -362,7 +362,9 @@
       print "cat " F[key]
       '$ac_cs_awk_pipe_init
   ac_cs_awk_pipe_fini='END { print "|#_!!_#|" }'
-fi]])dnl
+fi]])
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a
b" }' 2>/dev/null`
+if test "$ac_cs_awk_cr" = 'a
b'; then ac_cs_awk_cr=; else ac_cs_awk_cr='\\'; fi
 dnl
 dnl Define the pipe that does the substitution.
 m4_ifdef([_AC_SUBST_FILES],
@@ -375,14 +377,14 @@
 [m4_define([_AC_SUBST_CMDS],
 [| $AWK -f "$tmp/subs.awk"])])dnl
 
-echo 'BEGIN {' >"$tmp/subs.awk"
+echo 'BEGIN {' >"$tmp/subs1.awk"
 _ACEOF
 
 m4_ifdef([_AC_SUBST_FILES],
 [# Create commands to substitute file output variables.
 {
   echo "cat >>$CONFIG_STATUS <<_ACEOF"
-  echo 'cat >>"\$tmp/subs.awk" <<\CEOF'
+  echo 'cat >>"\$tmp/subs1.awk" <<\CEOF'
   echo "$ac_subst_files" | sed 's/.*/F@<:@"&"@:>@="$&"/'
   echo "CEOF"
   echo "_ACEOF"
@@ -439,7 +441,7 @@
 dnl
 dnl m4-double-quote most of the scripting for readability.
 [cat >>$CONFIG_STATUS <<_ACEOF
-cat >>"\$tmp/subs.awk" <<\CEOF
+cat >>"\$tmp/subs1.awk" <<\CEOF
 _ACEOF
 sed -n '
 h
@@ -487,7 +489,7 @@
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF
 CEOF
-cat >>"\$tmp/subs.awk" <<CEOF
+cat >>"\$tmp/subs1.awk" <<CEOF
   for (key in S) S_is_set[key] = 1
   FS = ""
 ]m4_ifdef([_AC_SUBST_FILES],
@@ -522,6 +524,7 @@
 ]m4_ifdef([_AC_SUBST_FILES],
 [\$ac_cs_awk_pipe_fini])[
 CEOF
+sed "s,
$,,; s,
,\$ac_cs_awk_cr&,g" < "\$tmp/subs1.awk" > "\$tmp/subs.awk"
 _ACEOF
 ]dnl end of double-quoted part
 
Index: tests/torture.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/torture.at,v
retrieving revision 1.79
diff -u -r1.79 torture.at
--- tests/torture.at    20 Dec 2006 00:09:44 -0000      1.79
+++ tests/torture.at    18 Jan 2007 20:53:09 -0000
@@ -632,18 +632,35 @@
 address@hidden@@bar@
 ])
 
+AT_DATA([Zardoz.in], address@hidden@
+])
+
 AT_CONFIGURE_AC(
 [[foo="AS@&address@hidden([[X*'[]+ ",& &`\($foo \& \\& \\\& \\\\& \ \\ \\\ 
!]])"
 bar="@foo@ @baz@"
 baz=bla
+( for i in 0 1 2 3; do
+    for j in 0 1 2 3 4 5 6 7; do
+      for k in 0 1 2 3 4 5 6 7; do
+       case $i$j$k in #(
+       000) ;; #(
+       *) printf \\$i$j$k ;;
+       esac
+      done
+    done
+  done
+  printf \\n
+) >allowed-chars
+zardoz=`cat allowed-chars`
 AC_SUBST([foo])
 AC_SUBST([bar])
 AC_SUBST([baz])
+AC_SUBST([zardoz])
 file=File
 AC_SUBST_FILE([file])
 AC_DEFINE([foo], [[X*'[]+ ",& &`\($foo !]], [Awful value.])
 AC_PROG_AWK
-AC_CONFIG_FILES([Foo])]])
+AC_CONFIG_FILES([Foo Zardoz])]])
 
 AT_CHECK_AUTOCONF
 AT_CHECK_AUTOHEADER
@@ -663,6 +680,7 @@
 address@hidden@
 @address@hidden
 ]])
+  AT_CHECK([cmp allowed-chars Zardoz])
   AT_CHECK_DEFINES([[#define foo X*'[]+ ",& &`\($foo !
 ]])
 done




reply via email to

[Prev in Thread] Current Thread [Next in Thread]