Disable the fflush-after-ungetc tests, since gnulib currently does not
authorBruno Haible <bruno@clisp.org>
Sat, 29 Mar 2008 11:59:48 +0000 (12:59 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 29 Mar 2008 11:59:48 +0000 (12:59 +0100)
guarantee consistent results.

ChangeLog
m4/fflush.m4
tests/test-fflush2.c

index 1a52a97..bee33a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-29  Bruno Haible  <bruno@clisp.org>
+
+       * tests/test-fflush2.c (main): Temporarily disable the contents of
+       this test.
+       * m4/fflush.m4 (gl_FUNC_FFLUSH): Add a TODO.
+       Reported by Eric Blake.
+
 2008-03-28  Simon Josefsson  <simon@josefsson.org>
 
        * lib/gc.h (enum Gc_hash): Add GC_SHA224.
index f796a55..e985ffe 100644 (file)
@@ -1,6 +1,6 @@
-# fflush.m4 serial 4
+# fflush.m4 serial 5
 
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007-2008 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -21,8 +21,11 @@ AC_DEFUN([gl_FUNC_FFLUSH],
 #include <unistd.h>
        ]], [[FILE *f = fopen ("conftest.txt", "r");
         char buffer[10];
-        int fd = fileno (f);
-        if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5)
+        int fd;
+        if (f == NULL)
+          return 1;
+        fd = fileno (f);
+        if (fd < 0 || fread (buffer, 1, 5, f) != 5)
           return 2;
         /* For deterministic results, ensure f read a bigger buffer.  */
         if (lseek (fd, 0, SEEK_CUR) == 5)
@@ -30,7 +33,11 @@ AC_DEFUN([gl_FUNC_FFLUSH],
         /* POSIX requires fflush-fseek to set file offset of fd.  */
         if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0)
           return 4;
-        return !(lseek (fd, 0, SEEK_CUR) == 5);
+        if (lseek (fd, 0, SEEK_CUR) != 5)
+          return 5;
+        /* TODO: Verify behaviour of fflush after ungetc, see
+           <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.  */
+        return 0;
        ]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no],
      [dnl Pessimistically assume fflush is broken.  This is wrong for
       dnl at least glibc and cygwin; but lib/fflush.c takes this into account.
index d5d8619..884b555 100644 (file)
 int
 main (int argc, char **argv)
 {
+#if 0
+  /* Check fflush after a backup ungetc() call.  This is case 1 in terms of
+     <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.
+     The Austin Group has not yet decided how this should behave.  */
+#endif
+#if 0
+  /* Check fflush after a non-backup ungetc() call.  This is case 1 in terms of
+     <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.
+     The Austin Group has not yet decided how this should behave.  */
   /* Check that fflush after a non-backup ungetc() call discards the ungetc
      buffer.  This is mandated by POSIX
      <http://www.opengroup.org/susv3/functions/ungetc.html>:
@@ -73,6 +82,7 @@ main (int argc, char **argv)
 
   c = fgetc (stdin);
   ASSERT (c == '/');
+#endif
 
   return 0;
 }