From adc924bb2fb338cd1c52d1c236be005c85871748 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 29 Mar 2008 12:59:48 +0100 Subject: [PATCH] Disable the fflush-after-ungetc tests, since gnulib currently does not guarantee consistent results. --- ChangeLog | 7 +++++++ m4/fflush.m4 | 17 ++++++++++++----- tests/test-fflush2.c | 10 ++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1a52a97f6..bee33a2cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-03-29 Bruno Haible + + * 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 * lib/gc.h (enum Gc_hash): Add GC_SHA224. diff --git a/m4/fflush.m4 b/m4/fflush.m4 index f796a5541..e985ffe48 100644 --- a/m4/fflush.m4 +++ b/m4/fflush.m4 @@ -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 ]], [[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 + . */ + 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. diff --git a/tests/test-fflush2.c b/tests/test-fflush2.c index d5d8619c3..884b5558b 100644 --- a/tests/test-fflush2.c +++ b/tests/test-fflush2.c @@ -48,6 +48,15 @@ int main (int argc, char **argv) { +#if 0 + /* Check fflush after a backup ungetc() call. This is case 1 in terms of + . + 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 + . + 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 : @@ -73,6 +82,7 @@ main (int argc, char **argv) c = fgetc (stdin); ASSERT (c == '/'); +#endif return 0; } -- 2.11.0