test-perror: relax test to ignore cygwin bug
authorEric Blake <eblake@redhat.com>
Tue, 7 Jun 2011 21:41:20 +0000 (15:41 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 7 Jun 2011 22:48:54 +0000 (16:48 -0600)
glibc was not the only platform where fprintf(fopen(,"r"))
fails to detect errors; cygwin 1.7.9 is another culprit
(although it will be fixed for 1.7.10), and I suspect that
several other platforms were failing perror2 for the same
reason.

At this point, there are so many functions affected, and
the way to avoid the bug is easy enough (don't pass bogus
streams to output-producing functions), that I'm not worried
about fixing things other than to document them.

* tests/test-perror2.c (main): Relax test on requiring detection
of stream errors, and use unbuffered stream.
* doc/posix-functions/dprintf.texi (dprintf): Document bug.
* doc/posix-functions/fprintf.texi (fprintf): Likewise.
* doc/posix-functions/fputc.texi (fputc): Likewise.
* doc/posix-functions/fputs.texi (fputs): Likewise.
* doc/posix-functions/fputws.texi (fputws): Likewise.
* doc/posix-functions/fwprintf.texi (fwprintf): Likewise.
* doc/posix-functions/fwrite.texi (fwrite): Likewise.
* doc/posix-functions/getopt.texi (getopt): Likewise.
* doc/posix-functions/perror.texi (perror): Likewise.
* doc/posix-functions/printf.texi (printf): Likewise.
* doc/posix-functions/psiginfo.texi (psiginfo): Likewise.
* doc/posix-functions/psignal.texi (psignal): Likewise.
* doc/posix-functions/putc.texi (putc): Likewise.
* doc/posix-functions/putc_unlocked.texi (putc_unlocked):
Likewise.
* doc/posix-functions/putchar.texi (putchar): Likewise.
* doc/posix-functions/putchar_unlocked.texi (putchar_unlocked):
Likewise.
* doc/posix-functions/puts.texi (puts): Likewise.
* doc/posix-functions/putwc.texi (putwc): Likewise.
* doc/posix-functions/putwchar.texi (putwchar): Likewise.
* doc/posix-functions/vdprintf.texi (vdprintf): Likewise.
* doc/posix-functions/vfprintf.texi (vfprintf): Likewise.
* doc/posix-functions/vfwprintf.texi (vfwprintf): Likewise.
* doc/posix-functions/vprintf.texi (vprintf): Likewise.
* doc/posix-functions/vwprintf.texi (vwprintf): Likewise.
* doc/posix-functions/wordexp.texi (wordexp): Likewise.
* doc/posix-functions/wprintf.texi (wprintf): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
28 files changed:
ChangeLog
doc/posix-functions/dprintf.texi
doc/posix-functions/fprintf.texi
doc/posix-functions/fputc.texi
doc/posix-functions/fputs.texi
doc/posix-functions/fputws.texi
doc/posix-functions/fwprintf.texi
doc/posix-functions/fwrite.texi
doc/posix-functions/getopt.texi
doc/posix-functions/perror.texi
doc/posix-functions/printf.texi
doc/posix-functions/psiginfo.texi
doc/posix-functions/psignal.texi
doc/posix-functions/putc.texi
doc/posix-functions/putc_unlocked.texi
doc/posix-functions/putchar.texi
doc/posix-functions/putchar_unlocked.texi
doc/posix-functions/puts.texi
doc/posix-functions/putwc.texi
doc/posix-functions/putwchar.texi
doc/posix-functions/vdprintf.texi
doc/posix-functions/vfprintf.texi
doc/posix-functions/vfwprintf.texi
doc/posix-functions/vprintf.texi
doc/posix-functions/vwprintf.texi
doc/posix-functions/wordexp.texi
doc/posix-functions/wprintf.texi
tests/test-perror2.c

index 59c64ae..870ec73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2011-06-07  Eric Blake  <eblake@redhat.com>
+
+       test-perror: relax test to ignore cygwin bug
+       * tests/test-perror2.c (main): Relax test on requiring detection
+       of stream errors, and use unbuffered stream.
+       * doc/posix-functions/dprintf.texi (dprintf): Document bug.
+       * doc/posix-functions/fprintf.texi (fprintf): Likewise.
+       * doc/posix-functions/fputc.texi (fputc): Likewise.
+       * doc/posix-functions/fputs.texi (fputs): Likewise.
+       * doc/posix-functions/fputws.texi (fputws): Likewise.
+       * doc/posix-functions/fwprintf.texi (fwprintf): Likewise.
+       * doc/posix-functions/fwrite.texi (fwrite): Likewise.
+       * doc/posix-functions/getopt.texi (getopt): Likewise.
+       * doc/posix-functions/perror.texi (perror): Likewise.
+       * doc/posix-functions/printf.texi (printf): Likewise.
+       * doc/posix-functions/psiginfo.texi (psiginfo): Likewise.
+       * doc/posix-functions/psignal.texi (psignal): Likewise.
+       * doc/posix-functions/putc.texi (putc): Likewise.
+       * doc/posix-functions/putc_unlocked.texi (putc_unlocked):
+       Likewise.
+       * doc/posix-functions/putchar.texi (putchar): Likewise.
+       * doc/posix-functions/putchar_unlocked.texi (putchar_unlocked):
+       Likewise.
+       * doc/posix-functions/puts.texi (puts): Likewise.
+       * doc/posix-functions/putwc.texi (putwc): Likewise.
+       * doc/posix-functions/putwchar.texi (putwchar): Likewise.
+       * doc/posix-functions/vdprintf.texi (vdprintf): Likewise.
+       * doc/posix-functions/vfprintf.texi (vfprintf): Likewise.
+       * doc/posix-functions/vfwprintf.texi (vfwprintf): Likewise.
+       * doc/posix-functions/vprintf.texi (vprintf): Likewise.
+       * doc/posix-functions/vwprintf.texi (vwprintf): Likewise.
+       * doc/posix-functions/wordexp.texi (wordexp): Likewise.
+       * doc/posix-functions/wprintf.texi (wprintf): Likewise.
+
 2011-05-22  Bruno Haible  <bruno@clisp.org>
 
        strerror: Move AC_LIBOBJ invocations to module description.
index dc39022..e267cda 100644 (file)
@@ -24,4 +24,8 @@ glibc-2.3.6.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 44bcca3..3948018 100644 (file)
@@ -86,5 +86,5 @@ Portability problems not fixed by Gnulib:
 @item
 Attempting to write to a read-only stream fails with @code{EOF} but
 does not set the error flag for @code{ferror} on some platforms:
-glibc 2.13.
+glibc 2.13, cygwin 1.7.9.
 @end itemize
index 9d6c9fd..1b5ba7c 100644 (file)
@@ -28,4 +28,8 @@ Portability problems not fixed by Gnulib:
 @item
 On Windows platforms (excluding Cygwin), this function does not set @code{errno}
 upon failure.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 7fc4bf5..a7e79d4 100644 (file)
@@ -28,4 +28,8 @@ Portability problems not fixed by Gnulib:
 @item
 On Windows platforms (excluding Cygwin), this function does not set @code{errno}
 upon failure.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index f3b2b4e..c842488 100644 (file)
@@ -18,4 +18,8 @@ IRIX 5.3, Solaris 2.5.1, Cygwin 1.5.x, BeOS.
 @item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 79ffc25..d245890 100644 (file)
@@ -18,4 +18,8 @@ NetBSD 3.0, OpenBSD 3.8, HP-UX 11.00, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Inter
 @item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 20f7fb8..c03a70c 100644 (file)
@@ -28,4 +28,8 @@ Portability problems not fixed by Gnulib:
 @item
 On Windows platforms (excluding Cygwin), this function does not set @code{errno}
 upon failure.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 4067295..bab4922 100644 (file)
@@ -67,4 +67,8 @@ causing a reset by setting it non-zero, although it does not
 necessarily re-read @env{POSIXLY_CORRECT}.  Solaris @code{getopt} does
 not support either reset method, but does not maintain state that
 needs the extra level of reset.
+@item
+On some platforms, this function does not set the stream error
+indicator on attempts to write to a read-only stream:
+glibc 2.13, Cygwin 1.7.9.
 @end itemize
index 167cf39..13231e9 100644 (file)
@@ -23,7 +23,7 @@ Portability problems not fixed by Gnulib:
 @item
 POSIX requires that this function set the stream error bit (detected
 by @code{ferror}) on write failure, but not all platforms do this:
-glibc 2.13.
+glibc 2.13, cygwin 1.7.9.
 @item
 POSIX requires that this function not alter stream orientation, but
 the gnulib replacement locks in byte orientation and fails on wide
index 8fc8cb0..db7218b 100644 (file)
@@ -86,5 +86,5 @@ Portability problems not fixed by Gnulib:
 @item
 Attempting to write to a read-only stream fails with @code{EOF} but
 does not set the error flag for @code{ferror} on some platforms:
-glibc 2.13.
+glibc 2.13, cygwin 1.7.9.
 @end itemize
index 2e940c0..a0f530b 100644 (file)
@@ -14,5 +14,6 @@ Portability problems not fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-glibc 2.3.6, MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, OSF/1 5.1, Cygwin, mingw, Interix 3.5, BeOS.
+glibc 2.3.6, MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX
+5.1, HP-UX 11, OSF/1 5.1, Cygwin 1.7.9, mingw, Interix 3.5, BeOS.
 @end itemize
index 1677949..75e6ed8 100644 (file)
@@ -14,5 +14,5 @@ Portability problems not fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-HP-UX 11, Cygwin, mingw, Interix 3.5, BeOS.
+HP-UX 11, Cygwin 1.7.9, mingw, Interix 3.5, BeOS.
 @end itemize
index d156461..c6a815e 100644 (file)
@@ -28,4 +28,8 @@ Portability problems not fixed by Gnulib:
 @item
 On Windows platforms (excluding Cygwin), this function does not set @code{errno}
 upon failure.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 0c3381e..4fbf3c4 100644 (file)
@@ -15,4 +15,8 @@ Portability problems not fixed by Gnulib:
 @item
 This function is missing on some platforms:
 mingw.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index aeb6b43..2ded45a 100644 (file)
@@ -28,4 +28,8 @@ Portability problems not fixed by Gnulib:
 @item
 On Windows platforms (excluding Cygwin), this function does not set @code{errno}
 upon failure.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 5bf55b3..bc9c3b0 100644 (file)
@@ -15,4 +15,8 @@ Portability problems not fixed by Gnulib:
 @item
 This function is missing on some platforms:
 mingw.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index ef350ac..31e3f0e 100644 (file)
@@ -28,4 +28,8 @@ Portability problems not fixed by Gnulib:
 @item
 On Windows platforms (excluding Cygwin), this function does not set @code{errno}
 upon failure.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 82a8a96..b624b25 100644 (file)
@@ -18,4 +18,8 @@ IRIX 5.3, Solaris 2.5.1, Cygwin 1.5.x, BeOS.
 @item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 985759a..28930c4 100644 (file)
@@ -18,4 +18,8 @@ IRIX 5.3, Solaris 2.5.1, Cygwin 1.5.x, BeOS.
 @item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 20a6ef7..8b06c3e 100644 (file)
@@ -42,4 +42,8 @@ BeOS.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index c6fab25..4999fb5 100644 (file)
@@ -86,5 +86,5 @@ Portability problems not fixed by Gnulib:
 @item
 Attempting to write to a read-only stream fails with @code{EOF} but
 does not set the error flag for @code{ferror} on some platforms:
-glibc 2.13.
+glibc 2.13, cygwin 1.7.9.
 @end itemize
index e018cf5..143704b 100644 (file)
@@ -18,4 +18,8 @@ NetBSD 3.0, OpenBSD 3.8, HP-UX 11.00, IRIX 6.5, Solaris 2.6, Cygwin 1.5.x, Inter
 @item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 21d4bc6..7534e01 100644 (file)
@@ -86,5 +86,5 @@ Portability problems not fixed by Gnulib:
 @item
 Attempting to write to a read-only stream fails with @code{EOF} but
 does not set the error flag for @code{ferror} on some platforms:
-glibc 2.13.
+glibc 2.13, cygwin 1.7.9.
 @end itemize
index e82834a..9f3e3b8 100644 (file)
@@ -22,4 +22,8 @@ platforms: Cygwin 1.5.x.
 @item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index f5d9eaf..6787200 100644 (file)
@@ -15,4 +15,8 @@ Portability problems not fixed by Gnulib:
 @item
 This function is missing on some platforms:
 MacOS X 10.3, OpenBSD 3.8, IRIX 5.3, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 885dd8b..330ca23 100644 (file)
@@ -22,4 +22,8 @@ platforms: Cygwin 1.5.x.
 @item
 On AIX and Windows platforms, @code{wchar_t} is a 16-bit type and therefore cannot
 accommodate all Unicode characters.
+@item
+On some platforms, this function does not set @code{errno} or the
+stream error indicator on attempts to write to a read-only stream:
+Cygwin 1.7.9.
 @end itemize
index 3aab640..e230f92 100644 (file)
@@ -116,12 +116,14 @@ main (void)
   /* Test that perror reports write failure.  */
   {
     ASSERT (freopen (BASE ".tmp", "r", stderr) == stderr);
-    ASSERT (setvbuf (stderr, NULL, _IOLBF, BUFSIZ) == 0);
+    ASSERT (setvbuf (stderr, NULL, _IONBF, BUFSIZ) == 0);
     errno = -1;
     ASSERT (!ferror (stderr));
     perror (NULL);
-    ASSERT (errno > 0);
 #if 0
+    /* Commented out until cygwin behaves:
+       http://sourceware.org/ml/newlib/2011/msg00228.html */
+    ASSERT (errno > 0);
     /* Commented out until glibc behaves:
        http://sourceware.org/bugzilla/show_bug.cgi?id=12792 */
     ASSERT (ferror (stderr));