m4-patches
[Top][All Lists]
Advanced

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

Re: m4-1.4.10 breaking autoconf?


From: Eric Blake
Subject: Re: m4-1.4.10 breaking autoconf?
Date: Sun, 22 Jul 2007 16:52:32 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.5) Gecko/20070716 Thunderbird/2.0.0.5 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Gary V. Vaughan on 7/22/2007 10:56 AM:
> Hi Eric,

Hi Gary,

> 
> On Jul 22, 2007, at 12:27 AM, Eric Blake wrote:
>> This is the patch, I'm still working on a testsuite addition:
>>
> 
> This bug seems to be present in HEAD too.  If so, can you please commit the
> patch there too?

Done.  For now, I'm giving up on a test on the branch - the only way to
reliably test it is to create an expected output file of at least 512k,
which the testsuite mechanism on the branch is not really equipped to do.
 I suppose we could backport the autotest framework to the branch, but
that also involves work.  So for now, the only test of this on the branch
is whether m4 can autoconf itself.  But for head, here's the patch,
including the testsuite addition (have I mentioned how much I like autotest?).

2007-07-22  Eric Blake  <address@hidden>

        Fix diversions on NetBSD, when fopen(name,"a+") seeks to end.
        * m4/output.c (m4_tmpopen): Explicitly seek to beginning.
        * tests/builtins.at (divert): Enhance test to cover this.
        * THANKS: Update.
        Reported by Thomas Klausner.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGo9+w84KuGfSFAYARAoOyAKDAPAE96NdaDDaRNI4aqay/Mu6wBQCgrkRQ
1Px3ZS3/4+Cn+uMMuQ0IHXY=
=5aWN
-----END PGP SIGNATURE-----
Index: m4/output.c
===================================================================
RCS file: /sources/m4/m4/m4/output.c,v
retrieving revision 1.46
diff -u -p -r1.46 output.c
--- m4/output.c 10 Jul 2007 20:48:09 -0000      1.46
+++ m4/output.c 22 Jul 2007 22:49:41 -0000
@@ -250,6 +250,11 @@ m4_tmpopen (m4 *context, int divnum)
              _("cannot create temporary file for diversion"));
   else if (set_cloexec_flag (fileno (file), true) != 0)
     m4_warn (context, errno, _("cannot protect diversion across forks"));
+  /* POSIX states that it is undefined whether an append stream starts
+     at offset 0 or at the end.  We want the beginning.  */
+  else if (fseeko (file, 0, SEEK_SET) != 0)
+    m4_error (context, EXIT_FAILURE, errno,
+             _("cannot seek to beginning of diversion"));
   return file;
 }
 
Index: tests/builtins.at
===================================================================
RCS file: /sources/m4/m4/tests/builtins.at,v
retrieving revision 1.42
diff -u -p -r1.42 builtins.at
--- tests/builtins.at   10 Jul 2007 20:48:10 -0000      1.42
+++ tests/builtins.at   22 Jul 2007 22:49:41 -0000
@@ -188,6 +188,42 @@ AT_CHECK_M4([-s in.m4], [0], [[#line 4 "
 hello world
 ]])
 
+dnl Test large diversions, which were broken in m4 1.4.8-1.4.10.
+AT_DATA([in.m4], [M4_ONE_MEG_DEFN[divert(`2')f`'dnl
+divert(`1')hello
+divert(`3')goodbye
+]])
+
+dnl Rather than open-code the 1 megabyte expected output, we reduce the
+dnl size of testsuite by constructing it.
+AT_DATA([expout], [[
+]])
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2
+cat expout2 expout2 > expout
+cat expout expout > expout2 # 512 kilobytes
+echo hello > expout
+cat expout2 expout2 >> expout # 1 megabyte
+echo goodbye >> expout
+rm expout2
+
+AT_CHECK_M4([in.m4], [0], [expout])
+
 AT_CLEANUP
 
 

reply via email to

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