[Zlib-devel] zlib-1.2.5.ebuild [WAS: zlib-1.2.5 configure script issues]

John Bowler jbowler at frontiernet.net
Mon Apr 26 16:33:19 EDT 2010


From: Arun Raghavan
>I actually meant to write in about this, since I wrote that patch. The
>patch is necessary because gzopen et al are #define'd to gzopen64 et
>al, conditional on _FILE_OFFSET_BITS and _LFS64_LARGEFILE, but the
>actual function is declared in the header only if _LARGEFILE64_SOURCE
>is defined. This breaks multiple applications that use zlib (libxml2
>and luatex, at least).

I think something is very wrong with this in 1.2.5.  Here's what happened to gseek in 1.2.4 zlib.h, note the '#ifndef _LARGEFILE64_SOURCE' line:

#ifdef _LARGEFILE64_SOURCE
   ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int));
#endif

#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS == 64
#  define gzseek gzseek64
#  ifndef _LARGEFILE64_SOURCE
     ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int));
#  endif
#else
   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
#endif

That all makes sense to me.  Now, here is 1.2.5 zlib.h; see how the #ifndef line has mysteriously changed into a #ifdef line:

#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
#endif

#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
#  define gzseek gzseek64
#  ifdef _LARGEFILE64_SOURCE
     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
#  endif
#else
   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
#endif

And this, I believe, is why gentoo applied the apparently mistaken patch - the fix, surely, is to put the magic 'n' back?

I don't, personally, think that the mapping to gzseek64 is correct if _LARGEFILE64_SOURCE is unset - I actually like the net effect of the gentoo patch more - but I may be misunderstanding the semantics of setting _FILE_OFFSET_BITS and _LFS64_LARGEFILE without setting _LARGEFILE64_SOURCE (I don't think the mapping should happen at all unless the including code gets *everything* right.)

John Bowler <jbowler at acm.org>






More information about the Zlib-devel mailing list