m4-patches
[Top][All Lists]
Advanced

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

Re: add some fd tests to head


From: Eric Blake
Subject: Re: add some fd tests to head
Date: Fri, 06 Oct 2006 23:05:37 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666

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

According to Eric Blake on 10/6/2006 12:24 PM:
> Finally, all the new tests now pass[*][**] on cygwin with this patch.
> 
> [*] if you use my proposed patch to gnulib clean-temp, not yet committed
> as of this writing
> [**] cygwin 1.5.21 and earlier had a bug in popen: if stdout is closed,
> popen fails to create a pipe.  This is fixed in cygwin CVS.

And once I upgraded to a cygwin snapshot, I discovered I still had a bug
in the test.  Plus, gnulib changed to make it possible to detect failure
in cleaning up the temp directory (unlikely, but if we print to stderr
stating that a temp file couldn't be deleted, the exit status might as
well reflect that).

2006-10-06  Eric Blake  <address@hidden>

        * m4/output.c (cleanup_tmpfile): Exit nonzero on failure to clean
        up.
        * tests/others.at (stdout closed): Fix final check.

- --
Life is short - so eat dessert first!

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

iD8DBQFFJzWh84KuGfSFAYARAne3AJ45HiuzYB2lYkH2VdtnAtJcJbCnXQCaApEe
YtlG2gb7+gB3sRLiM4R1jX4=
=vXT7
-----END PGP SIGNATURE-----
Index: m4/output.c
===================================================================
RCS file: /sources/m4/m4/m4/output.c,v
retrieving revision 1.31
diff -u -p -r1.31 output.c
--- m4/output.c 6 Oct 2006 18:24:31 -0000       1.31
+++ m4/output.c 7 Oct 2006 05:01:44 -0000
@@ -30,6 +30,7 @@
 
 #include "binary-io.h"
 #include "clean-temp.h"
+#include "exitfail.h"
 #include "xvasprintf.h"
 
 /* Define this to see runtime debug output.  Implied by DEBUG.  */
@@ -117,11 +118,13 @@ m4_output_exit (void)
 }
 
 /* Clean up any temporary directory.  Designed for use as an atexit
-   handler.  */
+   handler, where it is not safe to call exit() recursively; so this
+   calls _exit if a problem is encountered.  */
 static void
 cleanup_tmpfile (void)
 {
-  cleanup_temp_dir (output_temp_dir);
+  if (cleanup_temp_dir (output_temp_dir) != 0)
+    _exit (exit_failure);
 }
 
 /* Create a temporary file open for reading and writing in a secure
Index: tests/others.at
===================================================================
RCS file: /sources/m4/m4/tests/others.at,v
retrieving revision 1.22
diff -u -p -r1.22 others.at
--- tests/others.at     6 Oct 2006 18:24:31 -0000       1.22
+++ tests/others.at     7 Oct 2006 05:01:44 -0000
@@ -543,11 +543,13 @@ AT_DATA([in.m4], [[syscmd(`cat')dnl
 AT_CHECK_M4([>&-], [0], [], [experr], [in.m4])
 
 dnl command line input file must not collide with closed stdout
-AT_DATA([in.m4], [[syscmd(`cat <&1 >&2')
+AT_DATA([in.m4], [[syscmd(`cat <&1 >&2')dnl
 dnl this line should not be read by cat
 ]])
 AT_CHECK_M4([in.m4 >&-], [0], [], [stderr])
-AT_CHECK([sed -ne '/should not be read/p' stderr], [0])
+AT_CHECK([sed -e 's/.*\(Bad file descriptor\)$/\1/' stderr], [0],
+[[Bad file descriptor
+]])
 
 AT_CLEANUP
 

reply via email to

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