From 90ff767d14dfc21180977d5d152774b56a58915e Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 10 Jan 1997 17:40:07 +0000 Subject: [PATCH] I found the following bugs in the version 6.0 (dated 961229). At least the first two should be fixed before the final release of 6.0. 1) There is a mismatch between the type declared in the catalog for the input/output attributes of pg_type and the actual type of values stored in the table. The type of typinput, typoutput, typsend and typreceive are declared oid (26) while the values are regproc (24). The error was there also in previous versions but nobody noticed it until an Assert has been added in ExecEvalVar. The effect is that it is now impossible to replace the typoutput of existing data types with new procs. 2) The identd hba fails after the first time because the data read from the identd socket is not zero-terminated and strlen reports an incorrect length if the stack contains garbage, which usually happens after the first connection has been made. 3) The new initdb wants to create itself the data directory. This implies that the parent directory must be writable by postgres and this may not always be desirable. A better solution would be to allow the directory to be created by root and then filled by initdb. It would also nice to have some reasonable default for PGLIB and PGDATA like the previous version did. This applies also to the postmaster executable. --- src/backend/libpq/hba.c | 5 +++-- src/bin/initdb/initdb.sh | 6 +++--- src/include/catalog/pg_attribute.h | 10 +++++----- src/interfaces/libpgtcl/Makefile | 26 +++++++++++++++++++++++--- 4 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 76a3ca63fe..2dd44a97bf 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.13 1996/11/27 08:15:16 bryanh Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.14 1997/01/10 17:39:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -500,7 +500,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr, *ident_failed = true; } else { char ident_response[80+IDENT_USERNAME_MAX]; - rc = recv(sock_fd, ident_response, sizeof(ident_response), 0); + rc = recv(sock_fd, ident_response, sizeof(ident_response)-1, 0); if (rc < 0) { sprintf(PQerrormsg, "Unable to receive response from Ident server " @@ -515,6 +515,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr, *ident_failed = true; } else { bool error; /* response from Ident is garbage. */ + ident_response[rc] = '\0'; interpret_ident_response(ident_response, &error, ident_username); *ident_failed = error; } diff --git a/src/bin/initdb/initdb.sh b/src/bin/initdb/initdb.sh index f0c406586d..c0b9512b2f 100644 --- a/src/bin/initdb/initdb.sh +++ b/src/bin/initdb/initdb.sh @@ -26,7 +26,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.20 1996/12/23 08:50:27 bryanh Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.21 1997/01/10 17:39:40 momjian Exp $ # #------------------------------------------------------------------------- @@ -217,9 +217,9 @@ echo # umask must disallow access to group, other for files and dirs umask 077 -if [ -d "$PGDATA" ]; then +if [ -f "$PGDATA/PG_VERSION" ]; then if [ $template_only -eq 0 ]; then - echo "$CMDNAME: error: Directory $PGDATA already exists." + echo "$CMDNAME: error: File $PGDATA/PG_VERSION already exists." echo "This probably means initdb has already been run and the " echo "database system already exists." echo diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 56d7bae7ee..59564f7627 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_attribute.h,v 1.4 1996/11/13 20:50:54 scrappy Exp $ + * $Id: pg_attribute.h,v 1.5 1997/01/10 17:39:50 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -185,10 +185,10 @@ DATA(insert OID = 0 ( 1247 typisdefined 16 0 0 0 1 7 0 t t 0 0 -1 f c)); DATA(insert OID = 0 ( 1247 typdelim 18 0 0 0 1 8 0 t t 0 0 -1 f c)); DATA(insert OID = 0 ( 1247 typrelid 26 0 0 0 4 9 0 t t 0 0 -1 f i)); DATA(insert OID = 0 ( 1247 typelem 26 0 0 0 4 10 0 t t 0 0 -1 f i)); -DATA(insert OID = 0 ( 1247 typinput 26 0 0 0 4 11 0 t t 0 0 -1 f i)); -DATA(insert OID = 0 ( 1247 typoutput 26 0 0 0 4 12 0 t t 0 0 -1 f i)); -DATA(insert OID = 0 ( 1247 typreceive 26 0 0 0 4 13 0 t t 0 0 -1 f i)); -DATA(insert OID = 0 ( 1247 typsend 26 0 0 0 4 14 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 1247 typinput 24 0 0 0 4 11 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 1247 typoutput 24 0 0 0 4 12 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 1247 typreceive 24 0 0 0 4 13 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 1247 typsend 24 0 0 0 4 14 0 t t 0 0 -1 f i)); DATA(insert OID = 0 ( 1247 typalign 18 0 0 0 1 15 0 t t 0 0 -1 f c)); DATA(insert OID = 0 ( 1247 typdefault 25 0 0 0 -1 16 0 f t 0 0 -1 f i)); DATA(insert OID = 0 ( 1247 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); diff --git a/src/interfaces/libpgtcl/Makefile b/src/interfaces/libpgtcl/Makefile index cc9e554caf..c7d35a0417 100644 --- a/src/interfaces/libpgtcl/Makefile +++ b/src/interfaces/libpgtcl/Makefile @@ -7,7 +7,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile,v 1.6 1996/11/13 10:35:31 bryanh Exp $ +# $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile,v 1.7 1997/01/10 17:40:07 momjian Exp $ # #------------------------------------------------------------------------- @@ -31,7 +31,16 @@ endif OBJS= pgtcl.o pgtclCmds.o pgtclId.o -all: libpgtcl.a +ifdef LINUX_ELF + shlib := libpgtcl.so.1 + install-shlib-dep := install-shlib + LDFLAGS += -L ../libpq -lpq +else + shlib := + install-shlib-dep := +endif + +all: libpgtcl.a $(shlib) libpgtcl.a: $(OBJS) ifdef MK_NO_LORDER @@ -41,10 +50,15 @@ else endif $(RANLIB) libpgtcl.a +libpgtcl.so.1: $(OBJS) + $(CC) $(LDFLAGS) -shared $(OBJS) -o libpgtcl.so.1 + rm -f libpgtcl.so + ln -s libpgtcl.so.1 libpgtcl.so + .PHONY: beforeinstall-headers install-headers .PHONY: install install-libpgtcl -install: install-headers install-libpgtcl +install: install-headers install-libpgtcl $(install-shlib-dep) install-headers: beforeinstall-headers libpgtcl.h $(INSTALL) $(INSTLOPTS) libpgtcl.h $(HEADERDIR)/libpgtcl.h @@ -55,6 +69,12 @@ beforeinstall-headers: install-libpgtcl: libpgtcl.a $(INSTALL) $(INSTL_LIB_OPTS) libpgtcl.a $(DESTDIR)$(LIBDIR)/libpgtcl.a +install-shlib: libpgtcl.so.1 + $(INSTALL) $(INSTL_LIB_OPTS) libpgtcl.so.1 \ + $(DESTDIR)$(LIBDIR)/libpgtcl.so + rm -f $(DESTDIR)$(LIBDIR)/libpgtcl.so + ln -s libpgtcl.so.1 $(DESTDIR)$(LIBDIR)/libpgtcl.so + .PHONY: clean clean: rm -f $(OBJS)