bug-gnulib
[Top][All Lists]
Advanced

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

Re: more test suite problems


From: Eric Blake
Subject: Re: more test suite problems
Date: Tue, 27 Oct 2009 16:48:26 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Ian Beckwith <ianb <at> erislabs.net> writes:

> Debian stable & unstable, i386 & ia64.
> 
> Any of the modules listed in my last mail (or below), for instance this fails:
> 
> $ ./gnulib-tool --create-megatestdir  --with-tests --dir=test fseek fwritable
> $ cd test/ALL/
> $ ./configure
> $ make

Aha.  I finally figured out why my testing never saw this failure.  Debian has 
a broken glibc fflush() that none of my test platforms had, so my machine had 
no reason to replace fseeko and thus never picked up the bogus #define of 
fseek.  But I successfully used this command to simulate something like the 
Debian setup:

$ gl_cv_func_fflush_stdin=no gl_cv_var_stdin_large_offset=no \
   ./gnulib-tool --with-tests --test fseek fwritable

and verified that without the patch, I got the same failure, but with the 
patch, things worked correctly.  So, now that I (finally) got around to this 
bug, here's what I'm thinking about committing.  I specifically avoided making 
fseeko depend on fseek: in general, since fseek is an inherently limited 
interfaces, most programs should prefer to import fseeko rather than fseek.  
But since our replacement fflush requires seeking to work, whether the user did 
fseek or fseeko, I didn't mind adding the dependency there.

Hmm, while writing this email up, it occurs to me that maybe it is worth trying 
to also make fflush not depend on fseek, but instead making the stdio.in.h 
chunk for GNULIB_FSEEKO poisin fseek if GNULIB_FSEEK is not also defined.  That 
way, if the user explicitly asks for the fseek module, everything works; and if 
they don't ask for fseek but also don't use fseek(), they don't have to bloat 
their package with an unused fseek replacement.  So this patch may still be 
subject to change.


From: Eric Blake <address@hidden>
Date: Tue, 27 Oct 2009 10:42:50 -0600
Subject: [PATCH] fseek: avoid compilation failure when fflush is replaced

* modules/fflush (Depends-on): Add fseek.
* m4/fseek.m4 (gl_REPLACE_FSEEK): New macro.
* m4/fseeko.m4 (gl_REPLACE_FSEEKO): Also replace fseek, if fseek
module is in use.
* lib/stdio.in.h (GNULIB_FSEEKO): Don't define fseek; let
REPLACE_FSEEK take care of that instead.
(GNULIB_FTELLO): Likewise for ftell.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |   11 +++++++++++
 lib/stdio.in.h |    2 --
 m4/fseek.m4    |   16 ++++++++++------
 m4/fseeko.m4   |    8 +++++---
 modules/fflush |    1 +
 5 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0897109..5d6f3e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-27  Eric Blake  <address@hidden>
+
+       fseek: avoid compilation failure when fflush is replaced
+       * modules/fflush (Depends-on): Add fseek.
+       * m4/fseek.m4 (gl_REPLACE_FSEEK): New macro.
+       * m4/fseeko.m4 (gl_REPLACE_FSEEKO): Also replace fseek, if fseek
+       module is in use.
+       * lib/stdio.in.h (GNULIB_FSEEKO): Don't define fseek; let
+       REPLACE_FSEEK take care of that instead.
+       (GNULIB_FTELLO): Likewise for ftell.
+
 2009-10-26  Eric Blake  <address@hidden>

        areadlinkat: fix fallback path
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 7a0bc12..3d1de2b 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -227,7 +227,6 @@ extern int rpl_fseek (FILE *fp, long offset, int whence);
    fflush(), and which detect pipes.  */
 #  define fseeko rpl_fseeko
 extern int fseeko (FILE *fp, off_t offset, int whence);
-#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef fseeko
@@ -263,7 +262,6 @@ extern long rpl_ftell (FILE *fp);
 # if @REPLACE_FTELLO@
 #  define ftello rpl_ftello
 extern off_t ftello (FILE *fp);
-#  define ftell(fp) ftello (fp)
 # endif
 #elif defined GNULIB_POSIXCHECK
 # undef ftello
diff --git a/m4/fseek.m4 b/m4/fseek.m4
index 80e4501..c33297d 100644
--- a/m4/fseek.m4
+++ b/m4/fseek.m4
@@ -1,5 +1,5 @@
-# fseek.m4 serial 1
-dnl Copyright (C) 2007 Free Software Foundation, Inc.
+# fseek.m4 serial 2
+dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -9,8 +9,12 @@ AC_DEFUN([gl_FUNC_FSEEK],
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_FSEEKO])
   dnl When fseeko needs fixes, fseek needs them too.
-  if test $REPLACE_FSEEKO != 0; then
-    AC_LIBOBJ([fseek])
-    REPLACE_FSEEK=1
-  fi
+  dnl gl_FUNC_FSEEKO takes care of calling gl_REPLACE_FSEEK
+])
+
+AC_DEFUN([gl_REPLACE_FSEEK],
+[
+  AC_LIBOBJ([fseek])
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  REPLACE_FSEEK=1
 ])
diff --git a/m4/fseeko.m4 b/m4/fseeko.m4
index 3d77365..c9fbfb7 100644
--- a/m4/fseeko.m4
+++ b/m4/fseeko.m4
@@ -1,5 +1,5 @@
-# fseeko.m4 serial 4
-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
+# fseeko.m4 serial 5
+dnl Copyright (C) 2007-2009 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -15,7 +15,7 @@ AC_DEFUN([gl_FUNC_FSEEKO],

   AC_CACHE_CHECK([for fseeko], [gl_cv_func_fseeko],
     [
-      AC_TRY_LINK([#include <stdio.h>], [fseeko (stdin, 0, 0);],
+      AC_TRY_LINK([[#include <stdio.h>]], [fseeko (stdin, 0, 0);],
        [gl_cv_func_fseeko=yes], [gl_cv_func_fseeko=no])
     ])
   if test $gl_cv_func_fseeko = no; then
@@ -31,4 +31,6 @@ AC_DEFUN([gl_REPLACE_FSEEKO],
   AC_LIBOBJ([fseeko])
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   REPLACE_FSEEKO=1
+  dnl If we are also using the fseek module, then fseek needs replacing, too.
+  m4_ifdef([gl_REPLACE_FSEEK], [gl_REPLACE_FSEEK])
 ])
diff --git a/modules/fflush b/modules/fflush
index a8a151e..ca65032 100644
--- a/modules/fflush
+++ b/modules/fflush
@@ -13,6 +13,7 @@ freading
 lseek
 stdio
 unistd
+fseek
 fseeko

 configure.ac-early:
-- 
1.6.4.2







reply via email to

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