BUG #7588: pgsql 9.1 incompatible with zlib 1.27

Started by John Marinoover 13 years ago12 messagesbugs
Jump to latest
#1John Marino
draco@marino.st

The following bug has been logged on the website:

Bug reference: 7588
Logged by: John Marino
Email address: draco@marino.st
PostgreSQL version: 9.1.6
Operating system: DragonFlyBSD 3.1
Description:

DragonFly has zlib 1.27 as a base library. I noticed several zlib warnings
when pgsql 9.1.6 was being built with gcc47. The various utilities in
src/bin are using the zlib.h header incorrectly. I tried fixing it in
pkgsrc, but there were going to be a lot of patches and in on case the FH
type had to be FILE. I am attaching a partial log and a few of the patches
I was writing (not all correct but one can see what I was going for). There
are several files that need to be updated to properly support zlib 1.27
(which won't affect zlib 1.25 and below btw).

John

=====================================
$NetBSD$

Fix zlib bug which is revealed with zlib version 1.26+

--- src/bin/pg_basebackup/pg_basebackup.c.orig	2012-09-19 21:50:31.000000000
+0000
+++ src/bin/pg_basebackup/pg_basebackup.c
@@ -68,7 +68,7 @@ static void BaseBackup(void);

#ifdef HAVE_LIBZ
static const char *
-get_gz_error(gzFile *gzf)
+get_gz_error(gzFile gzf)
{
int errnum;
const char *errmsg;
@@ -276,7 +276,7 @@ ReceiveTarFile(PGconn *conn, PGresult *r
FILE *tarfile = NULL;

 #ifdef HAVE_LIBZ
-	gzFile	   *ztarfile = NULL;
+	gzFile	   ztarfile = NULL;
 #endif

if (PQgetisnull(res, rownum, 0))
$NetBSD$

--- src/bin/pg_dump/pg_backup_archiver.h.orig	2012-09-19 21:50:31.000000000
+0000
+++ src/bin/pg_dump/pg_backup_archiver.h
@@ -248,7 +248,11 @@ typedef struct _archiveHandle
 	int			blobCount;		/* # of blobs restored */
 	char	   *fSpec;			/* Archive File Spec */
+#ifdef HAVE_LIBZ
+	gzFile     FH;
+#else
 	FILE	   *FH;				/* General purpose file handle */
+#endif
 	void	   *OF;
 	int			gzOut;			/* Output file */

$NetBSD$

Fix zlib bug which is revealed with zlib version 1.26+

--- src/bin/pg_dump/pg_backup_files.c.orig	2012-09-19 21:50:31.000000000
+0000
+++ src/bin/pg_dump/pg_backup_files.c
@@ -58,7 +58,7 @@ typedef struct
 typedef struct
 {
 #ifdef HAVE_LIBZ
-	gzFile	   *FH;
+	gzFile	   FH;
 #else
 	FILE	   *FH;
 #endif
$NetBSD$

Fix zlib bug which is revealed with zlib version 1.26+

--- src/bin/pg_dump/pg_backup_tar.c.orig	2012-09-19 21:50:31.000000000
+0000
+++ src/bin/pg_dump/pg_backup_tar.c
@@ -58,7 +58,7 @@ static void _EndBlobs(ArchiveHandle *AH,

#ifdef HAVE_LIBZ
/* typedef gzFile ThingFile; */
-typedef FILE ThingFile;
+gzFile ThingFile;
#else
typedef FILE ThingFile;
#endif

gmake[1]: Entering directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/bin/pg_basebackup'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/bin/pg_dump -I../../../src/bin/psql
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
vacuumdb.o vacuumdb.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pg_basebackup.o pg_basebackup.c
rm -f pg_crc.c && ln -s ../../../src/backend/utils/hash/pg_crc.c .
/usr/pkg/bin/gmake -C ../../../src/port all
gmake[2]: Entering directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/port'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o help.o help.c
/usr/pkg/bin/gmake -C ../backend submake-errcodes
gmake[3]: Entering directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/backend'
gmake[3]: Nothing to be done for `submake-errcodes'.
gmake[3]: Leaving directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/backend'
gmake[2]: Leaving directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/port'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o pg_crc.o pg_crc.c
pg_basebackup.c: In function 'get_gz_error':
pg_basebackup.c:76:2: warning: passing argument 1 of 'gzerror' from
incompatible pointer type [enabled by default]
In file included from pg_basebackup.c:22:0:
/usr/include/zlib.h:1519:30: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
pg_basebackup.c: In function 'ReceiveTarFile':
pg_basebackup.c:292:14: warning: assignment from incompatible pointer type
[enabled by default]
pg_basebackup.c:293:5: warning: passing argument 1 of 'gzsetparams' from
incompatible pointer type [enabled by default]
In file included from pg_basebackup.c:22:0:
/usr/include/zlib.h:1287:21: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
pg_basebackup.c:310:14: warning: assignment from incompatible pointer type
[enabled by default]
pg_basebackup.c:311:5: warning: passing argument 1 of 'gzsetparams' from
incompatible pointer type [enabled by default]
In file included from pg_basebackup.c:22:0:
/usr/include/zlib.h:1287:21: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
pg_basebackup.c:334:13: warning: assignment from incompatible pointer type
[enabled by default]
pg_basebackup.c:335:4: warning: passing argument 1 of 'gzsetparams' from
incompatible pointer type [enabled by default]
In file included from pg_basebackup.c:22:0:
/usr/include/zlib.h:1287:21: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
pg_basebackup.c:409:5: warning: passing argument 1 of 'gzwrite' from
incompatible pointer type [enabled by default]
In file included from pg_basebackup.c:22:0:
/usr/include/zlib.h:1324:21: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
pg_basebackup.c:430:5: warning: passing argument 1 of 'gzclose' from
incompatible pointer type [enabled by default]
In file included from pg_basebackup.c:22:0:
/usr/include/zlib.h:1494:24: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
pg_basebackup.c:463:4: warning: passing argument 1 of 'gzwrite' from
incompatible pointer type [enabled by default]
In file included from pg_basebackup.c:22:0:
/usr/include/zlib.h:1324:21: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/bin/pg_dump -I../../../src/bin/psql
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
reindexdb.o reindexdb.c
/usr/pkg/bin/gmake -C ../../../src/interfaces/libpq all
gmake[2]: Entering directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/interfaces/libpq'
gmake[2]: Nothing to be done for `all'.
gmake[2]: Leaving directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/interfaces/libpq'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pg_backup_archiver.o pg_backup_archiver.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard pg_resetxlog.o
pg_crc.o -L../../../src/port -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib
-Wl,-R/usr/lib -Wl,--as-needed -Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl
-lcrypto -lz -lreadline -lcrypt -lm -o pg_resetxlog
gmake[1]: Leaving directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/bin/pg_resetxlog'
/usr/pkg/bin/gmake -C ../../../src/port all
gmake[2]: Entering directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/port'
/usr/pkg/bin/gmake -C ../backend submake-errcodes
gmake[3]: Entering directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/backend'
gmake[3]: Nothing to be done for `submake-errcodes'.
gmake[3]: Leaving directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/backend'
gmake[2]: Leaving directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/port'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -DFRONTEND
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
encnames.o encnames.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/bin/pg_dump -I../../../src/bin/psql
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
dumputils.o dumputils.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o input.o input.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/bin/pg_dump -I../../../src/bin/psql
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
kwlookup.o kwlookup.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o stringutils.o stringutils.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/bin/pg_dump -I../../../src/bin/psql
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
keywords.o keywords.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard pg_basebackup.o
-L../../../src/port -lpgport -L../../../src/interfaces/libpq -lpq
-L../../../src/port -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib
-Wl,-R/usr/lib -Wl,--as-needed -Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl
-lcrypto -lz -lreadline -lcrypt -lm -o pg_basebackup
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -DFRONTEND
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pqsignal.o pqsignal.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pg_backup_db.o pg_backup_db.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o mainloop.o mainloop.c
gmake[1]: Leaving directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/bin/pg_basebackup'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/bin/pg_dump -I../../../src/bin/psql
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o print.o
print.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard initdb.o encnames.o
pqsignal.o -L../../../src/port -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib
-Wl,-R/usr/lib -Wl,--as-needed -Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl
-lcrypto -lz -lreadline -lcrypt -lm -o initdb
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/bin/pg_dump -I../../../src/bin/psql
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
mbprint.o mbprint.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o copy.o copy.c
In file included from mainloop.c:425:0:
psqlscan.l: In function 'psql_scan_slash_option':
psqlscan.l:1563:9: warning: the comparison will always evaluate as 'false'
for the address of 'output' will never be NULL [-Waddress]
gmake[1]: Leaving directory
`/mech/construction/databases/postgresql91-client/work/postgresql-9.1.6/src/bin/initdb'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard vacuumdb.o common.o
-L../../../src/port -lpgport -L../../../src/interfaces/libpq -lpq
-L../../../src/port -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib
-Wl,-R/usr/lib -Wl,--as-needed -Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl
-lcrypto -lz -lreadline -lcrypt -lm -o vacuumdb
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pg_backup_custom.o pg_backup_custom.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o startup.o startup.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard reindexdb.o
common.o dumputils.o kwlookup.o keywords.o -L../../../src/port -lpgport
-L../../../src/interfaces/libpq -lpq -L../../../src/port -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,--as-needed
-Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl -lcrypto -lz -lreadline -lcrypt
-lm -o reindexdb
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pg_backup_files.o pg_backup_files.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o prompt.o prompt.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard createdb.o common.o
dumputils.o kwlookup.o keywords.o -L../../../src/port -lpgport
-L../../../src/interfaces/libpq -lpq -L../../../src/port -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,--as-needed
-Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl -lcrypto -lz -lreadline -lcrypt
-lm -o createdb
pg_backup_files.c: In function '_StartData':
pg_backup_files.c:256:11: warning: assignment from incompatible pointer type
[enabled by default]
pg_backup_files.c: In function '_WriteData':
pg_backup_files.c:271:2: warning: passing argument 1 of 'gzwrite' from
incompatible pointer type [enabled by default]
In file included from pg_backup_archiver.h:44:0,
from pg_backup_files.c:28:
/usr/include/zlib.h:1324:21: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
pg_backup_files.c: In function '_EndData':
pg_backup_files.c:282:2: warning: passing argument 1 of 'gzclose' from
incompatible pointer type [enabled by default]
In file included from pg_backup_archiver.h:44:0,
from pg_backup_files.c:28:
/usr/include/zlib.h:1494:24: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
pg_backup_files.c: In function '_PrintFileData':
pg_backup_files.c:301:9: warning: assignment from incompatible pointer type
[enabled by default]
pg_backup_files.c:310:2: warning: passing argument 1 of 'gzread' from
incompatible pointer type [enabled by default]
In file included from pg_backup_archiver.h:44:0,
from pg_backup_files.c:28:
/usr/include/zlib.h:1296:21: note: expected 'gzFile' but argument is of type
'struct FILE *'
pg_backup_files.c:316:2: warning: passing argument 1 of 'gzclose' from
incompatible pointer type [enabled by default]
In file included from pg_backup_archiver.h:44:0,
from pg_backup_files.c:28:
/usr/include/zlib.h:1494:24: note: expected 'gzFile' but argument is of type
'struct FILE *'
pg_backup_files.c: In function '_StartBlob':
pg_backup_files.c:523:11: warning: assignment from incompatible pointer type
[enabled by default]
pg_backup_files.c: In function '_EndBlob':
pg_backup_files.c:543:2: warning: passing argument 1 of 'gzclose' from
incompatible pointer type [enabled by default]
In file included from pg_backup_archiver.h:44:0,
from pg_backup_files.c:28:
/usr/include/zlib.h:1494:24: note: expected 'gzFile' but argument is of type
'struct gzFile_s **'
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard createuser.o
common.o dumputils.o kwlookup.o keywords.o -L../../../src/port -lpgport
-L../../../src/interfaces/libpq -lpq -L../../../src/port -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,--as-needed
-Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl -lcrypto -lz -lreadline -lcrypt
-lm -o createuser
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard dropdb.o common.o
dumputils.o kwlookup.o keywords.o -L../../../src/port -lpgport
-L../../../src/interfaces/libpq -lpq -L../../../src/port -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,--as-needed
-Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl -lcrypto -lz -lreadline -lcrypt
-lm -o dropdb
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o variables.o variables.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard dropuser.o common.o
dumputils.o kwlookup.o keywords.o -L../../../src/port -lpgport
-L../../../src/interfaces/libpq -lpq -L../../../src/port -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,--as-needed
-Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl -lcrypto -lz -lreadline -lcrypt
-lm -o dropuser
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o large_obj.o large_obj.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pg_backup_null.o pg_backup_null.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard clusterdb.o
common.o dumputils.o kwlookup.o keywords.o -L../../../src/port -lpgport
-L../../../src/interfaces/libpq -lpq -L../../../src/port -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,--as-needed
-Wl,-R'/usr/pkg/lib' -lpgport -lintl -lssl -lcrypto -lz -lreadline -lcrypt
-lm -o clusterdb
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o print.o print.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pg_backup_tar.o pg_backup_tar.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I.
-I../../../src/interfaces/libpq -I../../../src/bin/pg_dump
-I../../../src/include -I/usr/pkg/include/gettext -I/usr/include
-I/usr/pkg/include -c -o describe.o describe.c
cc -O2 -g -Wno-unused-but-set-variable -I/usr/pkg/include/gettext
-I/usr/include -I/usr/pkg/include -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-I../../../src/interfaces/libpq -I../../../src/include
-I/usr/pkg/include/gettext -I/usr/include -I/usr/pkg/include -c -o
pg_backup_directory.o pg_backup_directory.c
pg_backup_tar.c: In function 'tarOpen':
pg_backup_tar.c:423:12: warning: assignment from incompatible pointer type
[enabled by default]
pg_backup_tar.c: In function 'tarClose':
pg_backup_tar.c:451:3: warning: passing argument 1 of 'gzclose' from
incompatible pointer type [enabled by default]
In file included from pg_backup_archiver.h:44:0,
from pg_backup_tar.c:29:
/usr/include/zlib.h:1494:24: note: expected 'gzFile' but argument is of type
'struct ThingFile *'
pg_backup_tar.c: In function '_tarReadRaw':
pg_backup_tar.c:547:5: warning: passing argument 1 of 'gzread' from
incompatible pointer type [enabled by default]
In file included from pg_backup_archiver.h:44:0,
from pg_backup_tar.c:29:
/usr/include/zlib.h:1296:21: note: expected 'gzFile' but argument is of type
'struct ThingFile *'
pg_backup_tar.c: In function 'tarWrite':
pg_backup_tar.c:584:3: warning: passing argument 1 of 'gzwrite' from
incompatible pointer type [enabled by default]
In file included from pg_backup_archiver.h:44:0,
from pg_backup_tar.c:29:
/usr/include/zlib.h:1324:21: note: expected 'gzFile' but argument is of type
'struct ThingFile *'

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: John Marino (#1)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

draco@marino.st writes:

DragonFly has zlib 1.27 as a base library. I noticed several zlib warnings
when pgsql 9.1.6 was being built with gcc47. The various utilities in
src/bin are using the zlib.h header incorrectly.

This issue is dealt with in 9.2. I don't think we are going to change
it in previous release branches, because these are only warnings no?

regards, tom lane

#3John Marino
draco@marino.st
In reply to: Tom Lane (#2)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

On 10/7/2012 18:36, Tom Lane wrote:

DragonFly has zlib 1.27 as a base library. I noticed several zlib warnings
when pgsql 9.1.6 was being built with gcc47. The various utilities in
src/bin are using the zlib.h header incorrectly.

This issue is dealt with in 9.2. I don't think we are going to change
it in previous release branches, because these are only warnings no?

regards, tom lane

It successfully completes the build. I don't know if the warnings are
harmless or not. I would have thought the 9.2 fix would have been
backported to something as recent as version 9.1.x though especially
since 9.1 is the default version for pgsql in pkgsrc. If everyone is
sure that these warnings are harmless, I suppose its okay to live with them.

Thanks,
John

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: John Marino (#3)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

John Marino <draco@marino.st> writes:

On 10/7/2012 18:36, Tom Lane wrote:

This issue is dealt with in 9.2. I don't think we are going to change
it in previous release branches, because these are only warnings no?

It successfully completes the build. I don't know if the warnings are
harmless or not. I would have thought the 9.2 fix would have been
backported to something as recent as version 9.1.x though especially
since 9.1 is the default version for pgsql in pkgsrc.

The fix was nontrivial and involved removal of some (undocumented)
functionality, so we're not likely to consider backporting it unless
someone proves that the warnings are more than cosmetic. As far as
I can tell, they aren't.

http://git.postgresql.org/gitweb/?p=postgresql.git&amp;a=commitdiff&amp;h=d923125b77c5d698bb8107a533a21627582baa43
http://git.postgresql.org/gitweb/?p=postgresql.git&amp;a=commitdiff&amp;h=19f45565f581ce605956c29586bfd277f6012eec

regards, tom lane

#5John Marino
draco@marino.st
In reply to: Tom Lane (#4)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

On 10/7/2012 19:35, Tom Lane wrote:

John Marino<draco@marino.st> writes:

On 10/7/2012 18:36, Tom Lane wrote:

This issue is dealt with in 9.2. I don't think we are going to change
it in previous release branches, because these are only warnings no?

It successfully completes the build. I don't know if the warnings are
harmless or not. I would have thought the 9.2 fix would have been
backported to something as recent as version 9.1.x though especially
since 9.1 is the default version for pgsql in pkgsrc.

The fix was nontrivial and involved removal of some (undocumented)
functionality, so we're not likely to consider backporting it unless
someone proves that the warnings are more than cosmetic. As far as
I can tell, they aren't.

http://git.postgresql.org/gitweb/?p=postgresql.git&amp;a=commitdiff&amp;h=d923125b77c5d698bb8107a533a21627582baa43
http://git.postgresql.org/gitweb/?p=postgresql.git&amp;a=commitdiff&amp;h=19f45565f581ce605956c29586bfd277f6012eec

regards, tom lane

Yeah, I know it's nontrivial because I tried to patch it and hit the FH
as FILE* and gzFile conflict and realized the problem was more than
misdefined use of gzFile.

By the way, I also had to patch 9.1.6 in order to build it with gcc47:
Were these issues also fixed in postgres 9.2?

http://pkgsrc.se/files.php?messageId=20121007102454.6E70D175DD@cvs.netbsd.org

John

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: John Marino (#5)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

John Marino <draco@marino.st> writes:

By the way, I also had to patch 9.1.6 in order to build it with gcc47:
http://pkgsrc.se/files.php?messageId=20121007102454.6E70D175DD@cvs.netbsd.org

[ shrug... ] I just tried 9.1.6 with gcc 4.7.0 and 4.7.2 on Fedora, and
saw nothing but a handful of cosmetic warnings. I see the same on our
buildfarm member anchovy, which is running 4.7.1 on Arch Linux.

We generally don't bother to fix cosmetic warnings introduced by new
toolchains except in HEAD; it's just not worth the trouble. gcc in
particular seems to move the goalposts constantly, and most of the
warnings they've introduced recently are pure pedantry anyway (IMO).

The comments attached to your patches suggest that you saw errors rather
than warnings, but if so you've got distro-specific compiler bugs to
deal with. There is nothing even faintly non-legitimate about the code
chunks you changed.

regards, tom lane

#7John Marino
draco@marino.st
In reply to: Tom Lane (#6)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

On 10/7/2012 21:14, Tom Lane wrote:

John Marino<draco@marino.st> writes:

By the way, I also had to patch 9.1.6 in order to build it with gcc47:
http://pkgsrc.se/files.php?messageId=20121007102454.6E70D175DD@cvs.netbsd.org

[ shrug... ] I just tried 9.1.6 with gcc 4.7.0 and 4.7.2 on Fedora, and
saw nothing but a handful of cosmetic warnings. I see the same on our
buildfarm member anchovy, which is running 4.7.1 on Arch Linux.

We generally don't bother to fix cosmetic warnings introduced by new
toolchains except in HEAD; it's just not worth the trouble. gcc in
particular seems to move the goalposts constantly, and most of the
warnings they've introduced recently are pure pedantry anyway (IMO).

The comments attached to your patches suggest that you saw errors rather
than warnings, but if so you've got distro-specific compiler bugs to
deal with. There is nothing even faintly non-legitimate about the code
chunks you changed.

regards, tom lane

Hi Tom,
Perhaps, you need to take a closer look at this. I guarantee that I
didn't do this for cosmetic reasons. GCC behavior changed with GCC 4.5
on this topic.

From what I can tell, later version GCC does not consider these arrays
declared with a constant expression. Apparently it runs afoul of C99
section 6.6:
http://c0x.coding-guidelines.com/6.6.html

Things like sizeof, offsetof, etc in cause problems.

I don't know why you didn't reproduce it in Fedora. I can speculate
that Fedora has modified gcc from a stock vendor configuration or
perhaps changes the internal specs. Surely this isn't the first time
the topic has been brought up? I'm surprised.

The errors were coming something like, "variably modified at file
scope". One was a warning, two were errors that broke the compilation.

John

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: John Marino (#7)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

John Marino <draco@marino.st> writes:

Perhaps, you need to take a closer look at this. I guarantee that I
didn't do this for cosmetic reasons. GCC behavior changed with GCC 4.5
on this topic.

You should report it as a bug in whatever distro you're using, because
the behavior did *not* change anywhere else, and the code you say your
compiler is rejecting is clearly legal per C standard. sizeof() is
a compile-time constant.

regards, tom lane

#9John Marino
draco@marino.st
In reply to: Tom Lane (#8)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

On 10/7/2012 21:54, Tom Lane wrote:

John Marino<draco@marino.st> writes:

Perhaps, you need to take a closer look at this. I guarantee that I
didn't do this for cosmetic reasons. GCC behavior changed with GCC 4.5
on this topic.

You should report it as a bug in whatever distro you're using, because
the behavior did *not* change anywhere else, and the code you say your
compiler is rejecting is clearly legal per C standard. sizeof() is
a compile-time constant.

regards, tom lane

Tom, it's a stock gcc47.
It's not "sizeof" that is causing the problem.

One cause is bufpage.h,
#define SizeOfPageHeaderData (offsetof(PageHeaderData, pd_linp))

Offsetof is the offender.

Two more on htup.h:
#define MINIMAL_TUPLE_PADDING \
((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) %
MAXIMUM_ALIGNOF)
#define MaxHeapTuplesPerPage \
((int) ((BLCKSZ - SizeOfPageHeaderData) / \
(MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData))))

Again, offsetof is the offender in both cases.

Are you 100% sure that offsetof is evaluated at compile time? Is this
not part of section 6.6 that I quoted earlier?

John

#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: John Marino (#9)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

John Marino <draco@marino.st> writes:

Are you 100% sure that offsetof is evaluated at compile time? Is this
not part of section 6.6 that I quoted earlier?

My copy of C99 sayeth (in section 7.17)

offsetof(type, member-designator)

which expands to an integer constant expression that has
type size_t, the value of which is the offset in bytes, to
the structure member (designated by member-designator), from
the beginning of its structure (designated by type).

If your version of gcc isn't treating it as an integer constant
expression, you either have a bug in the compiler or a bug in your
version of <stddef.h>. And I will say once more that we have not
encountered any other report of gcc having a problem with this code.

regards, tom lane

#11John Marino
draco@marino.st
In reply to: Tom Lane (#10)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

On 10/7/2012 22:26, Tom Lane wrote:

John Marino<draco@marino.st> writes:

Are you 100% sure that offsetof is evaluated at compile time? Is this
not part of section 6.6 that I quoted earlier?

My copy of C99 sayeth (in section 7.17)

offsetof(type, member-designator)

which expands to an integer constant expression that has
type size_t, the value of which is the offset in bytes, to
the structure member (designated by member-designator), from
the beginning of its structure (designated by type).

If your version of gcc isn't treating it as an integer constant
expression, you either have a bug in the compiler or a bug in your
version of<stddef.h>. And I will say once more that we have not
encountered any other report of gcc having a problem with this code.

regards, tom lane

Thanks Tom.
It is possible the culprit is the offsetof expansion. I'm examining the
FreeBSD version and there's a slight difference from that. I will
investigate this further and pass on what I find out. I don't suspect
the compiler though -- I've seen this on multiple compilers in the last
few months, namely a stock gcc 4.6 as well. It also choked on offsetof.

Regards,
John

#12John Marino
draco@marino.st
In reply to: Tom Lane (#10)
Re: BUG #7588: pgsql 9.1 incompatible with zlib 1.27

On 10/7/2012 22:26, Tom Lane wrote:

John Marino<draco@marino.st> writes:

Are you 100% sure that offsetof is evaluated at compile time? Is this
not part of section 6.6 that I quoted earlier?

My copy of C99 sayeth (in section 7.17)

offsetof(type, member-designator)

which expands to an integer constant expression that has
type size_t, the value of which is the offset in bytes, to
the structure member (designated by member-designator), from
the beginning of its structure (designated by type).

If your version of gcc isn't treating it as an integer constant
expression, you either have a bug in the compiler or a bug in your
version of<stddef.h>. And I will say once more that we have not
encountered any other report of gcc having a problem with this code.

regards, tom lane

Final follow-up:
The culprit was indeed an older offsetof macro. I've committed a fix to
the trunk of DragonFly:
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/262e0d745238888fc693cd80f79c7ac0c513769f

Using the GCC builtin version of offsetof allows Postgresql 9.1.6 to
build without the recently added patches. I'm going to revert that
commit as well.

Thanks for the pointers, Tom!

John