bug-glibc
[Top][All Lists]
Advanced

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

Re: ac_sys_largefile / fseeko problem


From: Guido Draheim
Subject: Re: ac_sys_largefile / fseeko problem
Date: Mon, 17 Mar 2003 11:33:32 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.1) Gecko/20020826



Guido Draheim schrieb:


Paul Eggert schrieb:

Guido Draheim <address@hidden> writes:


I am using
AC_SYS_LARGEFILE
AC_CHECK_FUNCS(ftello fseeko)



Use AC_FUNC_FSEEKO rather than AC_CHECK_FUNCS(fseeko).
That should work around your problems.



Thanks. However, that macro still calls the glibc
behavior a bug, which I think is simply true. The
glibc cvs stdio.h should be fixed, - atleast do export
fseeko when #def __USE_FILE_OFFSET64 is set!! - just in
order to avoid that silent callframe-mismatch. In other
words, export the REDIRECT atleast when a redirect-call
is required to make things to function properly.

This mode is easily achieved, in the glibc stdio.h part
on fseeko: delete the __USE_LARGEFILE ifdefs within the
#else-part opened by that #ifndef __USE_FILE_OFFSET64.

This minimal change is strictly required unless glibc
maintainers like to see the next program to delete some
large database with an innocent fseeko call of a
software ported to lfs mode running on a glibc system.
Note that C compilers wouldn't even warn about the
missing fseeko declaration unless -Wall or similar was
given.

I had a second look at current glibc cvs - the
libio/stdio.h does have a different order for the
two ifdefs but still has the problematic behavior
of ommitting fseeko when strictly required through
the existance of __USE_FILE_OFFSET64


#ifdef __USE_LARGEFILE
# ifndef __USE_FILE_OFFSET64
/* Seek to a certain position on STREAM.  */
extern int fseeko (FILE *__stream, __off_t __off, int __whence) __THROW;
/* Return the current position of STREAM.  */
extern __off_t ftello (FILE *__stream) __THROW;
# else
#  ifdef __REDIRECT
extern int __REDIRECT (fseeko,
                       (FILE *__stream, __off64_t __off, int __whence) __THROW,
                       fseeko64);
extern __off64_t __REDIRECT (ftello, (FILE *__stream) __THROW, ftello64);
#  else
#   define fseeko fseeko64
#   define ftello ftello64
#  endif
# endif
#endif

and it should be patched atleast to be:

#ifndef __USE_FILE_OFFSET64
# ifdef __USE_LARGEFILE
/* Seek to a certain position on STREAM.  */
extern int fseeko (FILE *__stream, __off_t __off, int __whence) __THROW;
/* Return the current position of STREAM.  */
extern __off_t ftello (FILE *__stream) __THROW;
# endif
#else
# ifdef __REDIRECT
extern int __REDIRECT (fseeko,
                       (FILE *__stream, __off64_t __off, int __whence) __THROW,
                       fseeko64);
extern __off64_t __REDIRECT (ftello, (FILE *__stream) __THROW, ftello64);
# else
#   define fseeko fseeko64
#   define ftello ftello64
# endif
#endif

Personally, I think it would be the best to simply
add a global change in features.h

 #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
 # define __USE_FILE_OFFSET64    1
+# ifndef __USE_LARGEFILE
+# define __USE_LARGEFILE 1
+# endif
 #endif

This should avoid callframe-mismatches in all futures cases
where glibc developers decide to do things differently
without a need and differently than all other systems.

The missing fseeko-export might be called a feature-flaw
by glibc maintainers, the callframe mismatch is a plain
bug, IMHO a severe bug as all silent errors should be
called that can trash your database files.

-- cheers, guido            http://ac-archive.sf.net/largefile





reply via email to

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