[Zlib-devel] zlib 1.2.4 released
Nelson H. F. Beebe
beebe at math.utah.edu
Mon Mar 15 10:45:32 EDT 2010
>> So the DEC compiler doesn't any sort of variable argument list capability?
OSF/1 has both old and new style:
% ls -l /usr/include/*arg*.h
-r--r--r-- 1 bin bin 2646 Apr 12 1999 /usr/include/args.h
-r--r--r-- 1 bin bin 2529 Apr 12 1999 /usr/include/stdarg.h
-r--r--r-- 1 bin bin 2241 Apr 12 1999 /usr/include/varargs.h
I don't spot anything in the build logs that suggest that feature
was tested for:
% env CC=cc CFLAGS="-ieee -I/usr/local/include" CXX=cxx CXXFLAGS="-ieee -I/usr/local/include" LDFLAGS="-Wl,-rpath,/usr/local/lib -Wl,-oldstyle_liblookup
-L/usr/local/lib" LIBS="-lsnprintf" FC=f77 F77=f77 ./configure
Checking for shared library support...
Building shared library libz.so.1.2.4 with cc.
Checking for off64_t... No.
Checking for fseeko... No.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf().
Checking for snprintf() in stdio.h... No.
WARNING: snprintf() not found, falling back to sprintf(). zlib
can build but will be open to possible buffer-overflow security
vulnerabilities.
Checking for return value of sprintf()... Yes.
Checking for errno.h... Yes.
Because the configure script is hand-coded, it does not behave like
one from autoconf, leaving behind a config.log file with a detailed
record of its tests.
There is nothing in the newly-created files either:
% grep ARG zconf.h zlib.pc so_locations
zconf.h:#ifdef _LARGEFILE64_SOURCE
I then looked at what header files the compiler saw in example.c:
% cc -ieee -I/usr/local/include -DNO_FSEEKO -DNO_snprintf -E example.c |
grep '#.*/usr/include' |
awk '{print $3}' |
sort -u
"/usr/include/ctype.h"
"/usr/include/locale.h"
"/usr/include/mach/machine/vm_types.h"
"/usr/include/machine/machlimits.h"
"/usr/include/machine/machtime.h"
"/usr/include/standards.h"
"/usr/include/stdio.h"
"/usr/include/sys/access.h"
"/usr/include/sys/lc_core.h"
"/usr/include/sys/limits.h"
"/usr/include/sys/localedef.h"
"/usr/include/sys/rt_limits.h"
"/usr/include/sys/seek.h"
"/usr/include/sys/select.h"
"/usr/include/sys/syslimits.h"
"/usr/include/sys/types.h"
"/usr/include/unistd.h"
"/usr/include/va_list.h"
The only source file with "#include <stdarg.h>" is gzwrite.c (the one
with the failing code on OSF/1 Alpha):
% cc -ieee -I/usr/local/include -DNO_FSEEKO -DNO_snprintf -E gzwrite.c | grep '#.*/usr/include' | awk '{print $3}' | sort -u
"/usr/include/ctype.h"
"/usr/include/fcntl.h"
"/usr/include/locale.h"
"/usr/include/mach/machine/vm_types.h"
"/usr/include/machine/machlimits.h"
"/usr/include/machine/machtime.h"
"/usr/include/standards.h"
"/usr/include/stdio.h"
"/usr/include/sys/access.h"
"/usr/include/sys/fcntl.h"
"/usr/include/sys/lc_core.h"
"/usr/include/sys/limits.h"
"/usr/include/sys/localedef.h"
"/usr/include/sys/mode.h"
"/usr/include/sys/rt_limits.h"
"/usr/include/sys/seek.h"
"/usr/include/sys/select.h"
"/usr/include/sys/syslimits.h"
"/usr/include/sys/types.h"
"/usr/include/unistd.h"
"/usr/include/va_list.h"
Notice the absence of a line with stdarg.h.
I then looked at the source file, and see this:
#ifdef STDC
#include <stdarg.h>
...
The symbol STDC is evidently not defined in a cc compilation.
I then tried a configure and build with CC=c89, and that produced a
successful test:
% make check
hello world
zlib version 1.2.4 = 0x1240, compile flags = 0x20000a9
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek: hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!
*** zlib test OK ***
hello world
warning: different zlib version
zlib version 1.2.4 = 0x1240, compile flags = 0x20000a9
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek: hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!
*** zlib shared test OK ***
So, we have a workaround on this system: use c89 or gcc instead of cc.
I think that the code should have a minor revision to test, possible
with assert(), that sizeof(int) == sizeof(void *), before accepting
the varargs workaround in gzwrite.c. Alternatively, the configure
script could make a test on the sizes of pointers versus integers.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe at math.utah.edu -
- 155 S 1400 E RM 233 beebe at acm.org beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
More information about the Zlib-devel
mailing list