Skip to content

Commit 558730a

Browse files
committed
Clean up CREATE DATABASE processing to make it more robust and get rid
of special case for Windows port. Put a PG_TRY around most of createdb() to ensure that we remove copied subdirectories on failure, even if the failure happens while creating the pg_database row. (I think this explains Oliver Siegmar's recent report.) Having done that, there's no need for the fragile assumption that copydir() mustn't ereport(ERROR), so simplify its API. Eliminate the old code that used system("cp ...") to copy subdirectories, in favor of using copydir() on all platforms. This not only should allow much better error reporting, but allows us to fsync the created files before trusting that the copy has succeeded.
1 parent 0001e98 commit 558730a

File tree

6 files changed

+273
-277
lines changed

6 files changed

+273
-277
lines changed

configure

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14915,14 +14915,6 @@ fi
1491514915

1491614916
# Win32 support
1491714917
if test "$PORTNAME" = "win32"; then
14918-
case $LIBOBJS in
14919-
"copydir.$ac_objext" | \
14920-
*" copydir.$ac_objext" | \
14921-
"copydir.$ac_objext "* | \
14922-
*" copydir.$ac_objext "* ) ;;
14923-
*) LIBOBJS="$LIBOBJS copydir.$ac_objext" ;;
14924-
esac
14925-
1492614918
case $LIBOBJS in
1492714919
"gettimeofday.$ac_objext" | \
1492814920
*" gettimeofday.$ac_objext" | \

configure.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.417 2005/07/06 21:04:13 momjian Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.418 2005/08/02 19:02:30 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -913,7 +913,6 @@ fi
913913

914914
# Win32 support
915915
if test "$PORTNAME" = "win32"; then
916-
AC_LIBOBJ(copydir)
917916
AC_LIBOBJ(gettimeofday)
918917
AC_LIBOBJ(kill)
919918
AC_LIBOBJ(open)

src/Makefile.global.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-makefile-*-
2-
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.218 2005/07/28 03:15:52 tgl Exp $
2+
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.219 2005/08/02 19:02:31 tgl Exp $
33

44
#------------------------------------------------------------------------------
55
# All PostgreSQL makefiles include this file and use the variables it sets,
@@ -388,19 +388,17 @@ endif
388388

389389
##########################################################################
390390
#
391-
# substitute implementations of C library routines
391+
# substitute implementations of C library routines (see src/port/)
392392

393-
LIBOBJS = @LIBOBJS@ dirmod.o exec.o noblock.o path.o pipe.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
393+
LIBOBJS = @LIBOBJS@ copydir.o dirmod.o exec.o noblock.o path.o pipe.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
394394

395-
ifneq (,$(LIBOBJS))
396395
LIBS := -lpgport $(LIBS)
397396
# add location of libpgport.a to LDFLAGS
398397
ifdef PGXS
399398
override LDFLAGS := -L$(libdir) $(LDFLAGS)
400399
else
401400
override LDFLAGS := -L$(top_builddir)/src/port $(LDFLAGS)
402401
endif
403-
endif
404402

405403
# to make ws2_32.lib the last library, and always link with shfolder,
406404
# so SHGetFolderName isn't picked up from shell32.dll

0 commit comments

Comments
 (0)