From 24c5bf3138db46ca4c998ed42c6a7de74938b255 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Tue, 10 Sep 2013 16:01:09 +0200 Subject: [PATCH] rebase: upgrade to version 9.3.0 Version: 9.3.0-1 --- .gitignore | 4 +- README.rpm-dist | 25 +- generate-pdf.sh | 2 +- postgresql-9.2.4-aarch64-atomic-upgrade.patch | 34 - postgresql-9.2.4-perl-5.18.patch | 83 -- ...esql-9.2.4-upgrade-and-perm-problems.patch | 54 - ...=> postgresql-aarch64-atomic-upgrade.patch | 8 + postgresql-man.patch | 7 +- postgresql-multi-sockets.patch | 1218 ----------------- postgresql-python3.patch | 62 - postgresql-var-run-socket.patch | 52 +- postgresql.service | 2 +- postgresql.spec | 59 +- sources | 4 +- 14 files changed, 82 insertions(+), 1532 deletions(-) delete mode 100644 postgresql-9.2.4-aarch64-atomic-upgrade.patch delete mode 100644 postgresql-9.2.4-perl-5.18.patch delete mode 100644 postgresql-9.2.4-upgrade-and-perm-problems.patch rename postgresql-9.2.4-aarch64-atomic.patch => postgresql-aarch64-atomic-upgrade.patch (76%) delete mode 100644 postgresql-multi-sockets.patch delete mode 100644 postgresql-python3.patch diff --git a/.gitignore b/.gitignore index 46823fd..1ded8d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /postgresql-9.2.4.tar.bz2 -/postgresql-9.2.4-US.pdf -/postgresql-9.1.9.tar.bz2 +/postgresql-9.3.0-US.pdf +/postgresql-9.3.0.tar.bz2 diff --git a/README.rpm-dist b/README.rpm-dist index 2d7482b..e628f83 100644 --- a/README.rpm-dist +++ b/README.rpm-dist @@ -1,6 +1,6 @@ README.rpm-dist ----------------------------------------------------------------------------- -Version 9.2, for the PostgreSQL 9.2 RPM set. +Version 9.3, for the PostgreSQL 9.3 RPM set. Devrim Gündüz ----------------------------------------------------------------------------- @@ -23,9 +23,9 @@ This document exists to explain the layout of the RPMs for PostgreSQL, to describe various RPM specifics, and to document special features found in the RPMset. -This document is written to be applicable to version 9.2 of PostgreSQL, +This document is written to be applicable to version 9.3 of PostgreSQL, which is the current version of the RPMs as of this writing. More to the -point, versions prior to 9.2 are not documented here. +point, versions prior to 9.3 are not documented here. This document is intended for use only with the RPMs supplied in Red Hat Enterprise Linux, CentOS and Fedora. Note that there are also "PGDG" @@ -69,9 +69,9 @@ as 'postgres' you will need to set a password using passwd. UPGRADING AN INSTALLATION ----------------------------------------------------------------------------- -For a minor-version upgrade (such as 9.2.1 to 9.2.2), just install the +For a minor-version upgrade (such as 9.3.1 to 9.3.2), just install the new RPMs; there's usually nothing more to it than that. Upgrading -across a major release of PostgreSQL (for example, from 9.1.x to 9.2.x) +across a major release of PostgreSQL (for example, from 9.2.x to 9.3.x) requires more effort. If you are upgrading across more than one major release of PostgreSQL @@ -83,7 +83,7 @@ and run the dump file through psql to restore your data. In some major releases, the RPMs also support in-place upgrade from the immediately previous major release. Currently, you can upgrade in-place -from 9.1.x to 9.2.x. This is much faster than a dump and reload. +from 9.2.x to 9.3.x. This is much faster than a dump and reload. To do an in-place upgrade: * shut down the old postmaster ("systemctl stop postgresql.service") * optionally make a backup of /var/lib/pgsql/data/ (recommended!) @@ -148,8 +148,9 @@ this: Executables: /usr/bin Libraries: /usr/lib (or /usr/lib64 on 64-bit machines) -Documentation: /usr/share/doc/postgresql-docs-x.y.z/html -Contrib documentation: /usr/share/doc/postgresql-contrib-x.y.z +Documentation: /usr/share/doc/postgresql/html +PDF documentation: /usr/share/doc/postgresql-docs +Contrib documentation: /usr/share/doc/postgresql-contrib Source: not installed Data: /var/lib/pgsql/data Backup area: /var/lib/pgsql/backups @@ -167,7 +168,7 @@ the beauty of RPM -- you don't have to keep track of the files, RPM does it for you. These RPMs are designed to be LSB-compliant -- if you find this not to be the -case, please let us know by way of the pgsqlrpms-hackers@pgfoundry.org +case, please let us know by way of the pgsql-pkg-yum@postgresql.org mailing list. MULTIPLE POSTMASTERS @@ -340,7 +341,7 @@ CONTRIB FILES ------------------------------------------------------------------------------- The contents of the contrib tree are packaged into the -contrib subpackage and are processed with make and make install. There is documentation in -/usr/share/doc/postgresql-contrib-VERSION for these modules. Most of the +/usr/share/doc/postgresql-contrib for these modules. Most of the modules are in /usr/lib/pgsql (or /usr/lib64/pgsql) for loadable modules, and binaries are in /usr/bin. In the future these files may be split out, depending upon function and dependencies. @@ -348,9 +349,9 @@ split out, depending upon function and dependencies. MORE INFORMATION ------------------------------------------------------------------------------- You can get more information at http://www.postgresql.org and -http://yum.pgsqlrpms.org +http://yum.postgresql.org Please help make this packaging better -- let us know if you find problems, or better ways of doing things. You can reach us by e-mail at -pgsqlrpms-hackers@pgfoundry.org +pgsql-pkg-yum@postgresql.org ------------------------------------------------------------------------------- diff --git a/generate-pdf.sh b/generate-pdf.sh index 1365bb4..a268981 100755 --- a/generate-pdf.sh +++ b/generate-pdf.sh @@ -32,7 +32,7 @@ cd postgresql-$VERSION # Apply any patches that affect the PDF documentation -patch -p1 < ../postgresql-multi-sockets.patch +# patch -p1 < ../xxx.patch # Configure ... diff --git a/postgresql-9.2.4-aarch64-atomic-upgrade.patch b/postgresql-9.2.4-aarch64-atomic-upgrade.patch deleted file mode 100644 index 2b8c82e..0000000 --- a/postgresql-9.2.4-aarch64-atomic-upgrade.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git a/postgresql-9.1.9/src/include/storage/s_lock.h b/postgresql-9.1.9/src/include/storage/s_lock.h -index 987fb9c..1ba718c 100644 ---- a/postgresql-9.1.9/src/include/storage/s_lock.h -+++ b/postgresql-9.1.9/src/include/storage/s_lock.h -@@ -296,6 +296,29 @@ tas(volatile slock_t *lock) - #endif /* __arm__ */ - - -+/* -+ * On ARM64, we use __sync_lock_test_and_set(int *, int) if available. -+ */ -+#if defined(__aarch64__) || defined(__aarch64) -+#ifdef HAVE_GCC_INT_ATOMICS -+#define HAS_TEST_AND_SET -+ -+#define TAS(lock) tas(lock) -+ -+typedef int slock_t; -+ -+static __inline__ int -+tas(volatile slock_t *lock) -+{ -+ return __sync_lock_test_and_set(lock, 1); -+} -+ -+#define S_UNLOCK(lock) __sync_lock_release(lock) -+ -+#endif /* HAVE_GCC_INT_ATOMICS */ -+#endif /* __aarch64__ */ -+ -+ - /* S/390 and S/390x Linux (32- and 64-bit zSeries) */ - #if defined(__s390__) || defined(__s390x__) - #define HAS_TEST_AND_SET diff --git a/postgresql-9.2.4-perl-5.18.patch b/postgresql-9.2.4-perl-5.18.patch deleted file mode 100644 index dae9b60..0000000 --- a/postgresql-9.2.4-perl-5.18.patch +++ /dev/null @@ -1,83 +0,0 @@ -commit 035a5e1e8c346efe25df6be4627b5f24cc3736b1 -Author: Tom Lane -AuthorDate: Mon Jun 3 14:19:26 2013 -0400 -Commit: Tom Lane -CommitDate: Mon Jun 3 14:19:26 2013 -0400 - - Add semicolons to eval'd strings to hide a minor Perl behavioral change. - - "eval q{foo}" used to complain that the error was on line 2 of the eval'd - string, because eval internally tacked on "\n;" so that the end of the - erroneous command was indeed on line 2. But as of Perl 5.18 it more - sanely says that the error is on line 1. To avoid Perl-version-dependent - regression test results, use "eval q{foo;}" instead in the two places - where this matters. Per buildfarm. - - Since people might try to use newer Perl versions with older PG releases, - back-patch as far as 9.0 where these test cases were added. - -diff --git a/src/pl/plperl/expected/plperl.out b/src/pl/plperl/expected/plperl.out -index 29c1d11..d23a302 100644 ---- a/src/pl/plperl/expected/plperl.out -+++ b/src/pl/plperl/expected/plperl.out -@@ -626,8 +626,8 @@ DO $$ open my $fh, " upstream (612ecf311b) +~> #970661 + diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index d4a783f..29124b1 100644 --- a/src/include/storage/s_lock.h diff --git a/postgresql-man.patch b/postgresql-man.patch index de989f5..94a34c6 100644 --- a/postgresql-man.patch +++ b/postgresql-man.patch @@ -1,4 +1,7 @@ -# PostgreSQL manual page completion +PostgreSQL ecpg/initdb manual page fixes + +This was generated based on automatic Red Hat manual page scan (private +RHBZ#948933). ### ecpg ### @@ -11,7 +14,7 @@ diff -up postgresql-9.2.4/doc/src/sgml/man1/ecpg.1.broken postgresql-9.2.4/doc/s .PP +\fB\-h \fR +.RS 4 -+Parse a header file, this option includes otion \fB\-c\fR\&. ++Parse a header file, this option includes option \fB\-c\fR\&. +.RE +.PP \fB\-i\fR diff --git a/postgresql-multi-sockets.patch b/postgresql-multi-sockets.patch deleted file mode 100644 index 366bf28..0000000 --- a/postgresql-multi-sockets.patch +++ /dev/null @@ -1,1218 +0,0 @@ -Back-port of upstream 9.3 patch to support multiple sockets -(upstream git commits c9b0cbe98bd783e24a8c4d8d8ac472a494b81292 and -d2286a98ef3fb88bafb57381b4c20b8b878827f1, plus updates of derived -documentation files). - -Note the patch also touches html-stamp and man-stamp in doc/src/sgml/; -this is to keep the makefiles from trying to rebuild the derived doc -files. We don't want that to happen because the BuildRequires for the -package don't include the necessary documentation tools. Those diff -hunks *must be at the end* so that those files are newer than the -master doc files. - - -diff -Naur postgresql-9.2.3.orig/contrib/pg_upgrade/server.c postgresql-9.2.3/contrib/pg_upgrade/server.c ---- postgresql-9.2.3.orig/contrib/pg_upgrade/server.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/contrib/pg_upgrade/server.c 2013-02-06 19:57:37.124796707 -0500 -@@ -197,7 +197,8 @@ - snprintf(socket_string + strlen(socket_string), - sizeof(socket_string) - strlen(socket_string), - " -c %s='%s'", -- (GET_MAJOR_VERSION(cluster->major_version) < 903) ? -+ /* assume 9.1 build will not have unix_socket_directories patch */ -+ (GET_MAJOR_VERSION(cluster->major_version) < 902) ? - "unix_socket_directory" : "unix_socket_directories", - cluster->sockdir); - #endif -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/client-auth.sgml postgresql-9.2.3/doc/src/sgml/client-auth.sgml ---- postgresql-9.2.3.orig/doc/src/sgml/client-auth.sgml 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/client-auth.sgml 2013-02-06 19:57:37.125796568 -0500 -@@ -838,7 +838,7 @@ - unix_socket_permissions (and possibly - unix_socket_group) configuration parameters as - described in . Or you -- could set the unix_socket_directory -+ could set the unix_socket_directories - configuration parameter to place the socket file in a suitably - restricted directory. - -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/config.sgml postgresql-9.2.3/doc/src/sgml/config.sgml ---- postgresql-9.2.3.orig/doc/src/sgml/config.sgml 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/config.sgml 2013-02-06 19:57:37.128796163 -0500 -@@ -453,17 +453,24 @@ - - - -- -- unix_socket_directory (string) -+ -+ unix_socket_directories (string) - -- unix_socket_directory configuration parameter -+ unix_socket_directories configuration parameter - - - -- Specifies the directory of the Unix-domain socket on which the -- server is to listen for -- connections from client applications. The default is normally -- /tmp, but can be changed at build time. -+ Specifies the directory of the Unix-domain socket(s) on which the -+ server is to listen for connections from client applications. -+ Multiple sockets can be created by listing multiple directories -+ separated by commas. Whitespace between entries is -+ ignored; surround a directory name with double quotes if you need -+ to include whitespace or commas in the name. -+ An empty value -+ specifies not listening on any Unix-domain sockets, in which case -+ only TCP/IP sockets can be used to connect to the server. -+ The default value is normally -+ /tmp, but that can be changed at build time. - This parameter can only be set at server start. - - -@@ -472,8 +479,8 @@ - .s.PGSQL.nnnn where - nnnn is the server's port number, an ordinary file - named .s.PGSQL.nnnn.lock will be -- created in the unix_socket_directory directory. Neither -- file should ever be removed manually. -+ created in each of the unix_socket_directories directories. -+ Neither file should ever be removed manually. - - - -@@ -490,8 +497,8 @@ - - - -- Sets the owning group of the Unix-domain socket. (The owning -- user of the socket is always the user that starts the -+ Sets the owning group of the Unix-domain socket(s). (The owning -+ user of the sockets is always the user that starts the - server.) In combination with the parameter - unix_socket_permissions this can be used as - an additional access control mechanism for Unix-domain connections. -@@ -514,7 +521,7 @@ - - - -- Sets the access permissions of the Unix-domain socket. Unix-domain -+ Sets the access permissions of the Unix-domain socket(s). Unix-domain - sockets use the usual Unix file system permission set. - The parameter value is expected to be a numeric mode - specified in the format accepted by the -@@ -6621,7 +6628,7 @@ - - - -- unix_socket_directory = x -+ unix_socket_directories = x - - - -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/html/app-postgres.html postgresql-9.2.3/doc/src/sgml/html/app-postgres.html ---- postgresql-9.2.3.orig/doc/src/sgml/html/app-postgres.html 2013-02-04 16:35:38.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/html/app-postgres.html 2013-02-06 19:57:37.129796032 -0500 -@@ -574,11 +574,19 @@ - CLASS="COMMAND" - >postgres is to listen for -- connections from client applications. The default is normally -+ connections from client applications. The value can also be a -+ comma-separated list of directories. An empty value -+ specifies not listening on any Unix-domain sockets, in which case -+ only TCP/IP sockets can be used to connect to the server. -+ The default value is normally - /tmp, but can be changed at build time. -+>, but that can be changed at build time. -+ Specifying this option is equivalent to setting the unix_socket_directories configuration parameter. -

. Or you - could set the unix_socket_directoryunix_socket_directories - configuration parameter to place the socket file in a suitably - restricted directory. -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/html/bookindex.html postgresql-9.2.3/doc/src/sgml/html/bookindex.html ---- postgresql-9.2.3.orig/doc/src/sgml/html/bookindex.html 2013-02-04 16:36:12.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/html/bookindex.html 2013-02-06 19:57:37.133795530 -0500 -@@ -17243,7 +17243,7 @@ - >
unix_socket_directory configuration parameter, -+>unix_socket_directories configuration parameter, - Connection Settingslocal - connections is to use a Unix domain socket directory (unix_socket_directoryunix_socket_directories) that has write permission only - for a trusted local user. This prevents a malicious user from creating - their own socket file in that directory. If you are concerned that -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/html/runtime-config-connection.html postgresql-9.2.3/doc/src/sgml/html/runtime-config-connection.html ---- postgresql-9.2.3.orig/doc/src/sgml/html/runtime-config-connection.html 2013-02-04 16:35:19.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/html/runtime-config-connection.html 2013-02-06 19:57:37.135795292 -0500 -@@ -274,24 +274,31 @@ - >
unix_socket_directoryunix_socket_directories (string)

Specifies the directory of the Unix-domain socket on which the -- server is to listen for -- connections from client applications. The default is normally -+> Specifies the directory of the Unix-domain socket(s) on which the -+ server is to listen for connections from client applications. -+ Multiple sockets can be created by listing multiple directories -+ separated by commas. Whitespace between entries is -+ ignored; surround a directory name with double quotes if you need -+ to include whitespace or commas in the name. -+ An empty value -+ specifies not listening on any Unix-domain sockets, in which case -+ only TCP/IP sockets can be used to connect to the server. -+ The default value is normally - /tmp, but can be changed at build time. -+>, but that can be changed at build time. - This parameter can only be set at server start. -

.lock will be -- created in the unix_socket_directory directory. Neither -- file should ever be removed manually. -+>unix_socket_directories directories. -+ Neither file should ever be removed manually. -

This parameter is irrelevant on Windows, which does not have -@@ -344,8 +351,8 @@ - >)

Sets the owning group of the Unix-domain socket. (The owning -- user of the socket is always the user that starts the -+> Sets the owning group of the Unix-domain socket(s). (The owning -+ user of the sockets is always the user that starts the - server.) In combination with the parameter - )

Sets the access permissions of the Unix-domain socket. Unix-domain -+> Sets the access permissions of the Unix-domain socket(s). Unix-domain - sockets use the usual Unix file system permission set. - The parameter value is expected to be a numeric mode - specified in the format accepted by the -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/html/runtime-config-short.html postgresql-9.2.3/doc/src/sgml/html/runtime-config-short.html ---- postgresql-9.2.3.orig/doc/src/sgml/html/runtime-config-short.html 2013-02-04 16:35:20.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/html/runtime-config-short.html 2013-02-06 19:57:37.135795292 -0500 -@@ -330,7 +330,7 @@ - >unix_socket_directory = unix_socket_directories = x - Specifies the directory of the Unix-domain socket on which - postgres is to listen for -- connections from client applications. The default is normally -- /tmp, but can be changed at build time. -+ connections from client applications. The value can also be a -+ comma-separated list of directories. An empty value -+ specifies not listening on any Unix-domain sockets, in which case -+ only TCP/IP sockets can be used to connect to the server. -+ The default value is normally -+ /tmp, but that can be changed at build time. -+ Specifying this option is equivalent to setting the configuration parameter. - - - -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/runtime.sgml postgresql-9.2.3/doc/src/sgml/runtime.sgml ---- postgresql-9.2.3.orig/doc/src/sgml/runtime.sgml 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/runtime.sgml 2013-02-06 19:57:37.137795062 -0500 -@@ -1798,7 +1798,7 @@ - - The simplest way to prevent spoofing for local - connections is to use a Unix domain socket directory () that has write permission only -+ linkend="guc-unix-socket-directories">) that has write permission only - for a trusted local user. This prevents a malicious user from creating - their own socket file in that directory. If you are concerned that - some applications might still reference /tmp for the -diff -Naur postgresql-9.2.3.orig/src/backend/libpq/pqcomm.c postgresql-9.2.3/src/backend/libpq/pqcomm.c ---- postgresql-9.2.3.orig/src/backend/libpq/pqcomm.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/backend/libpq/pqcomm.c 2013-02-06 19:57:37.138794950 -0500 -@@ -42,7 +42,7 @@ - * StreamServerPort - Open postmaster's server port - * StreamConnection - Create new connection with client - * StreamClose - Close a client/backend connection -- * TouchSocketFile - Protect socket file against /tmp cleaners -+ * TouchSocketFiles - Protect socket files against /tmp cleaners - * pq_init - initialize libpq at backend startup - * pq_comm_reset - reset libpq during error recovery - * pq_close - shutdown libpq at backend exit -@@ -103,8 +103,8 @@ - char *Unix_socket_group; - - --/* Where the Unix socket file is */ --static char sock_path[MAXPGPATH]; -+/* Where the Unix socket files are (list of palloc'd strings) */ -+static List *sock_paths = NIL; - - - /* -@@ -140,8 +140,8 @@ - static void pq_set_nonblocking(bool nonblocking); - - #ifdef HAVE_UNIX_SOCKETS --static int Lock_AF_UNIX(unsigned short portNumber, char *unixSocketName); --static int Setup_AF_UNIX(void); -+static int Lock_AF_UNIX(char *unixSocketDir, char *unixSocketPath); -+static int Setup_AF_UNIX(char *sock_path); - #endif /* HAVE_UNIX_SOCKETS */ - - -@@ -234,29 +234,43 @@ - - /* StreamDoUnlink() - * Shutdown routine for backend connection -- * If a Unix socket is used for communication, explicitly close it. -+ * If any Unix sockets are used for communication, explicitly close them. - */ - #ifdef HAVE_UNIX_SOCKETS - static void - StreamDoUnlink(int code, Datum arg) - { -- Assert(sock_path[0]); -- unlink(sock_path); -+ ListCell *l; -+ -+ /* Loop through all created sockets... */ -+ foreach(l, sock_paths) -+ { -+ char *sock_path = (char *) lfirst(l); -+ -+ unlink(sock_path); -+ } -+ /* Since we're about to exit, no need to reclaim storage */ -+ sock_paths = NIL; - } - #endif /* HAVE_UNIX_SOCKETS */ - - /* - * StreamServerPort -- open a "listening" port to accept connections. - * -- * Successfully opened sockets are added to the ListenSocket[] array, -- * at the first position that isn't PGINVALID_SOCKET. -+ * family should be AF_UNIX or AF_UNSPEC; portNumber is the port number. -+ * For AF_UNIX ports, hostName should be NULL and unixSocketDir must be -+ * specified. For TCP ports, hostName is either NULL for all interfaces or -+ * the interface to listen on, and unixSocketDir is ignored (can be NULL). -+ * -+ * Successfully opened sockets are added to the ListenSocket[] array (of -+ * length MaxListen), at the first position that isn't PGINVALID_SOCKET. - * - * RETURNS: STATUS_OK or STATUS_ERROR - */ - - int - StreamServerPort(int family, char *hostName, unsigned short portNumber, -- char *unixSocketName, -+ char *unixSocketDir, - pgsocket ListenSocket[], int MaxListen) - { - pgsocket fd; -@@ -273,6 +287,9 @@ - int listen_index = 0; - int added = 0; - -+#ifdef HAVE_UNIX_SOCKETS -+ char unixSocketPath[MAXPGPATH]; -+#endif - #if !defined(WIN32) || defined(IPV6_V6ONLY) - int one = 1; - #endif -@@ -286,10 +303,22 @@ - #ifdef HAVE_UNIX_SOCKETS - if (family == AF_UNIX) - { -- /* Lock_AF_UNIX will also fill in sock_path. */ -- if (Lock_AF_UNIX(portNumber, unixSocketName) != STATUS_OK) -+ /* -+ * Create unixSocketPath from portNumber and unixSocketDir and lock -+ * that file path -+ */ -+ UNIXSOCK_PATH(unixSocketPath, portNumber, unixSocketDir); -+ if (strlen(unixSocketPath) >= UNIXSOCK_PATH_BUFLEN) -+ { -+ ereport(LOG, -+ (errmsg("Unix-domain socket path \"%s\" is too long (maximum %d bytes)", -+ unixSocketPath, -+ (int) (UNIXSOCK_PATH_BUFLEN - 1)))); -+ return STATUS_ERROR; -+ } -+ if (Lock_AF_UNIX(unixSocketDir, unixSocketPath) != STATUS_OK) - return STATUS_ERROR; -- service = sock_path; -+ service = unixSocketPath; - } - else - #endif /* HAVE_UNIX_SOCKETS */ -@@ -432,7 +461,7 @@ - (IS_AF_UNIX(addr->ai_family)) ? - errhint("Is another postmaster already running on port %d?" - " If not, remove socket file \"%s\" and retry.", -- (int) portNumber, sock_path) : -+ (int) portNumber, service) : - errhint("Is another postmaster already running on port %d?" - " If not, wait a few seconds and retry.", - (int) portNumber))); -@@ -443,7 +472,7 @@ - #ifdef HAVE_UNIX_SOCKETS - if (addr->ai_family == AF_UNIX) - { -- if (Setup_AF_UNIX() != STATUS_OK) -+ if (Setup_AF_UNIX(service) != STATUS_OK) - { - closesocket(fd); - break; -@@ -490,18 +519,8 @@ - * Lock_AF_UNIX -- configure unix socket file path - */ - static int --Lock_AF_UNIX(unsigned short portNumber, char *unixSocketName) -+Lock_AF_UNIX(char *unixSocketDir, char *unixSocketPath) - { -- UNIXSOCK_PATH(sock_path, portNumber, unixSocketName); -- if (strlen(sock_path) >= UNIXSOCK_PATH_BUFLEN) -- { -- ereport(LOG, -- (errmsg("Unix-domain socket path \"%s\" is too long (maximum %d bytes)", -- sock_path, -- (int) (UNIXSOCK_PATH_BUFLEN - 1)))); -- return STATUS_ERROR; -- } -- - /* - * Grab an interlock file associated with the socket file. - * -@@ -510,13 +529,23 @@ - * more portable, and second, it lets us remove any pre-existing socket - * file without race conditions. - */ -- CreateSocketLockFile(sock_path, true); -+ CreateSocketLockFile(unixSocketPath, true, unixSocketDir); - - /* - * Once we have the interlock, we can safely delete any pre-existing - * socket file to avoid failure at bind() time. - */ -- unlink(sock_path); -+ unlink(unixSocketPath); -+ -+ /* -+ * Arrange to unlink the socket file(s) at proc_exit. If this is the -+ * first one, set up the on_proc_exit function to do it; then add this -+ * socket file to the list of files to unlink. -+ */ -+ if (sock_paths == NIL) -+ on_proc_exit(StreamDoUnlink, 0); -+ -+ sock_paths = lappend(sock_paths, pstrdup(unixSocketPath)); - - return STATUS_OK; - } -@@ -526,11 +555,8 @@ - * Setup_AF_UNIX -- configure unix socket permissions - */ - static int --Setup_AF_UNIX(void) -+Setup_AF_UNIX(char *sock_path) - { -- /* Arrange to unlink the socket file at exit */ -- on_proc_exit(StreamDoUnlink, 0); -- - /* - * Fix socket ownership/permission if requested. Note we must do this - * before we listen() to avoid a window where unwanted connections could -@@ -712,20 +738,24 @@ - } - - /* -- * TouchSocketFile -- mark socket file as recently accessed -+ * TouchSocketFiles -- mark socket files as recently accessed - * - * This routine should be called every so often to ensure that the socket -- * file has a recent mod date (ordinary operations on sockets usually won't -- * change the mod date). That saves it from being removed by -+ * files have a recent mod date (ordinary operations on sockets usually won't -+ * change the mod date). That saves them from being removed by - * overenthusiastic /tmp-directory-cleaner daemons. (Another reason we should - * never have put the socket file in /tmp...) - */ - void --TouchSocketFile(void) -+TouchSocketFiles(void) - { -- /* Do nothing if we did not create a socket... */ -- if (sock_path[0] != '\0') -+ ListCell *l; -+ -+ /* Loop through all created sockets... */ -+ foreach(l, sock_paths) - { -+ char *sock_path = (char *) lfirst(l); -+ - /* - * utime() is POSIX standard, utimes() is a common alternative. If we - * have neither, there's no way to affect the mod or access time of -diff -Naur postgresql-9.2.3.orig/src/backend/postmaster/postmaster.c postgresql-9.2.3/src/backend/postmaster/postmaster.c ---- postgresql-9.2.3.orig/src/backend/postmaster/postmaster.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/backend/postmaster/postmaster.c 2013-02-06 19:57:37.139794840 -0500 -@@ -156,7 +156,9 @@ - - /* The socket number we are listening for connections on */ - int PostPortNumber; --char *UnixSocketDir; -+/* The directory names for Unix socket(s) */ -+char *Unix_socket_directories; -+/* The TCP listen address(es) */ - char *ListenAddresses; - - /* -@@ -608,7 +610,7 @@ - break; - - case 'k': -- SetConfigOption("unix_socket_directory", optarg, PGC_POSTMASTER, PGC_S_ARGV); -+ SetConfigOption("unix_socket_directories", optarg, PGC_POSTMASTER, PGC_S_ARGV); - break; - - case 'l': -@@ -852,7 +854,7 @@ - /* Need a modifiable copy of ListenAddresses */ - rawstring = pstrdup(ListenAddresses); - -- /* Parse string into list of identifiers */ -+ /* Parse string into list of hostnames */ - if (!SplitIdentifierString(rawstring, ',', &elemlist)) - { - /* syntax error in list */ -@@ -868,12 +870,12 @@ - if (strcmp(curhost, "*") == 0) - status = StreamServerPort(AF_UNSPEC, NULL, - (unsigned short) PostPortNumber, -- UnixSocketDir, -+ NULL, - ListenSocket, MAXLISTEN); - else - status = StreamServerPort(AF_UNSPEC, curhost, - (unsigned short) PostPortNumber, -- UnixSocketDir, -+ NULL, - ListenSocket, MAXLISTEN); - - if (status == STATUS_OK) -@@ -892,7 +894,7 @@ - curhost))); - } - -- if (!success && list_length(elemlist)) -+ if (!success && elemlist != NIL) - ereport(FATAL, - (errmsg("could not create any TCP/IP sockets"))); - -@@ -939,13 +941,54 @@ - #endif - - #ifdef HAVE_UNIX_SOCKETS -- status = StreamServerPort(AF_UNIX, NULL, -- (unsigned short) PostPortNumber, -- UnixSocketDir, -- ListenSocket, MAXLISTEN); -- if (status != STATUS_OK) -- ereport(WARNING, -- (errmsg("could not create Unix-domain socket"))); -+ if (Unix_socket_directories) -+ { -+ char *rawstring; -+ List *elemlist; -+ ListCell *l; -+ int success = 0; -+ -+ /* Need a modifiable copy of Unix_socket_directories */ -+ rawstring = pstrdup(Unix_socket_directories); -+ -+ /* Parse string into list of directories */ -+ if (!SplitDirectoriesString(rawstring, ',', &elemlist)) -+ { -+ /* syntax error in list */ -+ ereport(FATAL, -+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE), -+ errmsg("invalid list syntax for \"unix_socket_directories\""))); -+ } -+ -+ foreach(l, elemlist) -+ { -+ char *socketdir = (char *) lfirst(l); -+ -+ status = StreamServerPort(AF_UNIX, NULL, -+ (unsigned short) PostPortNumber, -+ socketdir, -+ ListenSocket, MAXLISTEN); -+ -+ if (status == STATUS_OK) -+ { -+ success++; -+ /* record the first successful Unix socket in lockfile */ -+ if (success == 1) -+ AddToDataDirLockFile(LOCK_FILE_LINE_SOCKET_DIR, socketdir); -+ } -+ else -+ ereport(WARNING, -+ (errmsg("could not create Unix-domain socket in directory \"%s\"", -+ socketdir))); -+ } -+ -+ if (!success && elemlist != NIL) -+ ereport(FATAL, -+ (errmsg("could not create any Unix-domain sockets"))); -+ -+ list_free_deep(elemlist); -+ pfree(rawstring); -+ } - #endif - - /* -@@ -1435,15 +1478,15 @@ - } - - /* -- * Touch the socket and lock file every 58 minutes, to ensure that -+ * Touch Unix socket and lock files every 58 minutes, to ensure that - * they are not removed by overzealous /tmp-cleaning tasks. We assume - * no one runs cleaners with cutoff times of less than an hour ... - */ - now = time(NULL); - if (now - last_touch_time >= 58 * SECS_PER_MINUTE) - { -- TouchSocketFile(); -- TouchSocketLockFile(); -+ TouchSocketFiles(); -+ TouchSocketLockFiles(); - last_touch_time = now; - } - } -diff -Naur postgresql-9.2.3.orig/src/backend/tcop/postgres.c postgresql-9.2.3/src/backend/tcop/postgres.c ---- postgresql-9.2.3.orig/src/backend/tcop/postgres.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/backend/tcop/postgres.c 2013-02-06 19:57:37.140794732 -0500 -@@ -3333,7 +3333,7 @@ - break; - - case 'k': -- SetConfigOption("unix_socket_directory", optarg, ctx, gucsource); -+ SetConfigOption("unix_socket_directories", optarg, ctx, gucsource); - break; - - case 'l': -diff -Naur postgresql-9.2.3.orig/src/backend/utils/adt/varlena.c postgresql-9.2.3/src/backend/utils/adt/varlena.c ---- postgresql-9.2.3.orig/src/backend/utils/adt/varlena.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/backend/utils/adt/varlena.c 2013-02-06 19:57:37.141794626 -0500 -@@ -2446,6 +2446,119 @@ - } - - -+/* -+ * SplitDirectoriesString --- parse a string containing directory names -+ * -+ * This is similar to SplitIdentifierString, except that the parsing -+ * rules are meant to handle pathnames instead of identifiers: there is -+ * no downcasing, embedded spaces are allowed, the max length is MAXPGPATH-1, -+ * and we apply canonicalize_path() to each extracted string. Because of the -+ * last, the returned strings are separately palloc'd rather than being -+ * pointers into rawstring --- but we still scribble on rawstring. -+ * -+ * Inputs: -+ * rawstring: the input string; must be modifiable! -+ * separator: the separator punctuation expected between directories -+ * (typically ',' or ';'). Whitespace may also appear around -+ * directories. -+ * Outputs: -+ * namelist: filled with a palloc'd list of directory names. -+ * Caller should list_free_deep() this even on error return. -+ * -+ * Returns TRUE if okay, FALSE if there is a syntax error in the string. -+ * -+ * Note that an empty string is considered okay here. -+ */ -+bool -+SplitDirectoriesString(char *rawstring, char separator, -+ List **namelist) -+{ -+ char *nextp = rawstring; -+ bool done = false; -+ -+ *namelist = NIL; -+ -+ while (isspace((unsigned char) *nextp)) -+ nextp++; /* skip leading whitespace */ -+ -+ if (*nextp == '\0') -+ return true; /* allow empty string */ -+ -+ /* At the top of the loop, we are at start of a new directory. */ -+ do -+ { -+ char *curname; -+ char *endp; -+ -+ if (*nextp == '\"') -+ { -+ /* Quoted name --- collapse quote-quote pairs */ -+ curname = nextp + 1; -+ for (;;) -+ { -+ endp = strchr(nextp + 1, '\"'); -+ if (endp == NULL) -+ return false; /* mismatched quotes */ -+ if (endp[1] != '\"') -+ break; /* found end of quoted name */ -+ /* Collapse adjacent quotes into one quote, and look again */ -+ memmove(endp, endp + 1, strlen(endp)); -+ nextp = endp; -+ } -+ /* endp now points at the terminating quote */ -+ nextp = endp + 1; -+ } -+ else -+ { -+ /* Unquoted name --- extends to separator or end of string */ -+ curname = endp = nextp; -+ while (*nextp && *nextp != separator) -+ { -+ /* trailing whitespace should not be included in name */ -+ if (!isspace((unsigned char) *nextp)) -+ endp = nextp + 1; -+ nextp++; -+ } -+ if (curname == endp) -+ return false; /* empty unquoted name not allowed */ -+ } -+ -+ while (isspace((unsigned char) *nextp)) -+ nextp++; /* skip trailing whitespace */ -+ -+ if (*nextp == separator) -+ { -+ nextp++; -+ while (isspace((unsigned char) *nextp)) -+ nextp++; /* skip leading whitespace for next */ -+ /* we expect another name, so done remains false */ -+ } -+ else if (*nextp == '\0') -+ done = true; -+ else -+ return false; /* invalid syntax */ -+ -+ /* Now safe to overwrite separator with a null */ -+ *endp = '\0'; -+ -+ /* Truncate path if it's overlength */ -+ if (strlen(curname) >= MAXPGPATH) -+ curname[MAXPGPATH - 1] = '\0'; -+ -+ /* -+ * Finished isolating current name --- add it to list -+ */ -+ curname = pstrdup(curname); -+ canonicalize_path(curname); -+ *namelist = lappend(*namelist, curname); -+ -+ /* Loop back if we didn't reach end of string */ -+ } while (!done); -+ -+ return true; -+} -+ -+ - /***************************************************************************** - * Comparison Functions used for bytea - * -diff -Naur postgresql-9.2.3.orig/src/backend/utils/init/miscinit.c postgresql-9.2.3/src/backend/utils/init/miscinit.c ---- postgresql-9.2.3.orig/src/backend/utils/init/miscinit.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/backend/utils/init/miscinit.c 2013-02-06 20:03:33.247073549 -0500 -@@ -49,8 +49,8 @@ - - ProcessingMode Mode = InitProcessing; - --/* Note: we rely on this to initialize as zeroes */ --static char socketLockFile[MAXPGPATH]; -+/* List of lock files to be removed at proc exit */ -+static List *lock_files = NIL; - - - /* ---------------------------------------------------------------- -@@ -640,32 +640,35 @@ - */ - - /* -- * proc_exit callback to remove a lockfile. -+ * proc_exit callback to remove lockfiles. - */ - static void --UnlinkLockFile(int status, Datum filename) -+UnlinkLockFiles(int status, Datum arg) - { -- char *fname = (char *) DatumGetPointer(filename); -+ ListCell *l; - -- if (fname != NULL) -+ foreach(l, lock_files) - { -- if (unlink(fname) != 0) -- { -- /* Should we complain if the unlink fails? */ -- } -- free(fname); -+ char *curfile = (char *) lfirst(l); -+ -+ unlink(curfile); -+ /* Should we complain if the unlink fails? */ - } -+ /* Since we're about to exit, no need to reclaim storage */ -+ lock_files = NIL; - } - - /* - * Create a lockfile. - * -- * filename is the name of the lockfile to create. -+ * filename is the path name of the lockfile to create. - * amPostmaster is used to determine how to encode the output PID. -+ * socketDir is the Unix socket directory path to include (possibly empty). - * isDDLock and refName are used to determine what error message to produce. - */ - static void - CreateLockFile(const char *filename, bool amPostmaster, -+ const char *socketDir, - bool isDDLock, const char *refName) - { - int fd; -@@ -891,12 +894,7 @@ - DataDir, - (long) MyStartTime, - PostPortNumber, --#ifdef HAVE_UNIX_SOCKETS -- (*UnixSocketDir != '\0') ? UnixSocketDir : DEFAULT_PGSOCKET_DIR --#else -- "" --#endif -- ); -+ socketDir); - - /* - * In a standalone backend, the next line (LOCK_FILE_LINE_LISTEN_ADDR) -@@ -941,9 +939,14 @@ - } - - /* -- * Arrange for automatic removal of lockfile at proc_exit. -+ * Arrange to unlink the lock file(s) at proc_exit. If this is the -+ * first one, set up the on_proc_exit function to do it; then add this -+ * lock file to the list of files to unlink. - */ -- on_proc_exit(UnlinkLockFile, PointerGetDatum(strdup(filename))); -+ if (lock_files == NIL) -+ on_proc_exit(UnlinkLockFiles, 0); -+ -+ lock_files = lappend(lock_files, pstrdup(filename)); - } - - /* -@@ -952,41 +955,50 @@ - * When this is called, we must have already switched the working - * directory to DataDir, so we can just use a relative path. This - * helps ensure that we are locking the directory we should be. -+ * -+ * Note that the socket directory path line is initially written as empty. -+ * postmaster.c will rewrite it upon creating the first Unix socket. - */ - void - CreateDataDirLockFile(bool amPostmaster) - { -- CreateLockFile(DIRECTORY_LOCK_FILE, amPostmaster, true, DataDir); -+ CreateLockFile(DIRECTORY_LOCK_FILE, amPostmaster, "", true, DataDir); - } - - /* - * Create a lockfile for the specified Unix socket file. - */ - void --CreateSocketLockFile(const char *socketfile, bool amPostmaster) -+CreateSocketLockFile(const char *socketfile, bool amPostmaster, -+ const char *socketDir) - { - char lockfile[MAXPGPATH]; - - snprintf(lockfile, sizeof(lockfile), "%s.lock", socketfile); -- CreateLockFile(lockfile, amPostmaster, false, socketfile); -- /* Save name of lockfile for TouchSocketLockFile */ -- strcpy(socketLockFile, lockfile); -+ CreateLockFile(lockfile, amPostmaster, socketDir, false, socketfile); - } - - /* -- * TouchSocketLockFile -- mark socket lock file as recently accessed -+ * TouchSocketLockFiles -- mark socket lock files as recently accessed - * -- * This routine should be called every so often to ensure that the lock file -- * has a recent mod or access date. That saves it -+ * This routine should be called every so often to ensure that the socket -+ * lock files have a recent mod or access date. That saves them - * from being removed by overenthusiastic /tmp-directory-cleaner daemons. - * (Another reason we should never have put the socket file in /tmp...) - */ - void --TouchSocketLockFile(void) -+TouchSocketLockFiles(void) - { -- /* Do nothing if we did not create a socket... */ -- if (socketLockFile[0] != '\0') -+ ListCell *l; -+ -+ foreach(l, lock_files) - { -+ char *socketLockFile = (char *) lfirst(l); -+ -+ /* No need to touch the data directory lock file, we trust */ -+ if (strcmp(socketLockFile, DIRECTORY_LOCK_FILE) == 0) -+ continue; -+ - /* - * utime() is POSIX standard, utimes() is a common alternative; if we - * have neither, fall back to actually reading the file (which only -@@ -1018,8 +1030,10 @@ - * Add (or replace) a line in the data directory lock file. - * The given string should not include a trailing newline. - * -- * Caution: this erases all following lines. In current usage that is OK -- * because lines are added in order. We could improve it if needed. -+ * Note: because we don't truncate the file, if we were to rewrite a line -+ * with less data than it had before, there would be garbage after the last -+ * line. We don't ever actually do that, so not worth adding another kernel -+ * call to cover the possibility. - */ - void - AddToDataDirLockFile(int target_line, const char *str) -@@ -1027,8 +1041,10 @@ - int fd; - int len; - int lineno; -- char *ptr; -- char buffer[BLCKSZ]; -+ char *srcptr; -+ char *destptr; -+ char srcbuffer[BLCKSZ]; -+ char destbuffer[BLCKSZ]; - - fd = open(DIRECTORY_LOCK_FILE, O_RDWR | PG_BINARY, 0); - if (fd < 0) -@@ -1039,7 +1055,7 @@ - DIRECTORY_LOCK_FILE))); - return; - } -- len = read(fd, buffer, sizeof(buffer) - 1); -+ len = read(fd, srcbuffer, sizeof(srcbuffer) - 1); - if (len < 0) - { - ereport(LOG, -@@ -1049,37 +1065,51 @@ - close(fd); - return; - } -- buffer[len] = '\0'; -+ srcbuffer[len] = '\0'; - - /* -- * Skip over lines we are not supposed to rewrite. -+ * Advance over lines we are not supposed to rewrite, then copy them -+ * to destbuffer. - */ -- ptr = buffer; -+ srcptr = srcbuffer; - for (lineno = 1; lineno < target_line; lineno++) - { -- if ((ptr = strchr(ptr, '\n')) == NULL) -+ if ((srcptr = strchr(srcptr, '\n')) == NULL) - { - elog(LOG, "incomplete data in \"%s\": found only %d newlines while trying to add line %d", - DIRECTORY_LOCK_FILE, lineno - 1, target_line); - close(fd); - return; - } -- ptr++; -+ srcptr++; - } -+ memcpy(destbuffer, srcbuffer, srcptr - srcbuffer); -+ destptr = destbuffer + (srcptr - srcbuffer); - - /* - * Write or rewrite the target line. - */ -- snprintf(ptr, buffer + sizeof(buffer) - ptr, "%s\n", str); -+ snprintf(destptr, destbuffer + sizeof(destbuffer) - destptr, "%s\n", str); -+ destptr += strlen(destptr); -+ -+ /* -+ * If there are more lines in the old file, append them to destbuffer. -+ */ -+ if ((srcptr = strchr(srcptr, '\n')) != NULL) -+ { -+ srcptr++; -+ snprintf(destptr, destbuffer + sizeof(destbuffer) - destptr, "%s", -+ srcptr); -+ } - - /* - * And rewrite the data. Since we write in a single kernel call, this - * update should appear atomic to onlookers. - */ -- len = strlen(buffer); -+ len = strlen(destbuffer); - errno = 0; - if (lseek(fd, (off_t) 0, SEEK_SET) != 0 || -- (int) write(fd, buffer, len) != len) -+ (int) write(fd, destbuffer, len) != len) - { - /* if write didn't set errno, assume problem is no disk space */ - if (errno == 0) -diff -Naur postgresql-9.2.3.orig/src/backend/utils/misc/guc.c postgresql-9.2.3/src/backend/utils/misc/guc.c ---- postgresql-9.2.3.orig/src/backend/utils/misc/guc.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/backend/utils/misc/guc.c 2013-02-06 19:57:37.144794320 -0500 -@@ -2894,14 +2894,18 @@ - }, - - { -- {"unix_socket_directory", PGC_POSTMASTER, CONN_AUTH_SETTINGS, -- gettext_noop("Sets the directory where the Unix-domain socket will be created."), -+ {"unix_socket_directories", PGC_POSTMASTER, CONN_AUTH_SETTINGS, -+ gettext_noop("Sets the directories where Unix-domain sockets will be created."), - NULL, - GUC_SUPERUSER_ONLY - }, -- &UnixSocketDir, -+ &Unix_socket_directories, -+#ifdef HAVE_UNIX_SOCKETS -+ DEFAULT_PGSOCKET_DIR, -+#else - "", -- check_canonical_path, NULL, NULL -+#endif -+ NULL, NULL, NULL - }, - - { -diff -Naur postgresql-9.2.3.orig/src/backend/utils/misc/postgresql.conf.sample postgresql-9.2.3/src/backend/utils/misc/postgresql.conf.sample ---- postgresql-9.2.3.orig/src/backend/utils/misc/postgresql.conf.sample 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/backend/utils/misc/postgresql.conf.sample 2013-02-06 19:57:37.145794222 -0500 -@@ -65,7 +65,8 @@ - # Note: Increasing max_connections costs ~400 bytes of shared memory per - # connection slot, plus lock space (see max_locks_per_transaction). - #superuser_reserved_connections = 3 # (change requires restart) --#unix_socket_directory = '' # (change requires restart) -+#unix_socket_directories = '/tmp' # comma-separated list of directories -+ # (change requires restart) - #unix_socket_group = '' # (change requires restart) - #unix_socket_permissions = 0777 # begin with 0 to use octal notation - # (change requires restart) -diff -Naur postgresql-9.2.3.orig/src/bin/initdb/initdb.c postgresql-9.2.3/src/bin/initdb/initdb.c ---- postgresql-9.2.3.orig/src/bin/initdb/initdb.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/bin/initdb/initdb.c 2013-02-06 19:57:37.146794124 -0500 -@@ -983,7 +983,7 @@ - setup_config(void) - { - char **conflines; -- char repltok[TZ_STRLEN_MAX + 100]; -+ char repltok[MAXPGPATH]; - char path[MAXPGPATH]; - const char *default_timezone; - -@@ -1005,6 +1005,15 @@ - n_buffers * (BLCKSZ / 1024)); - conflines = replace_token(conflines, "#shared_buffers = 32MB", repltok); - -+#ifdef HAVE_UNIX_SOCKETS -+ snprintf(repltok, sizeof(repltok), "#unix_socket_directories = '%s'", -+ DEFAULT_PGSOCKET_DIR); -+#else -+ snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''"); -+#endif -+ conflines = replace_token(conflines, "#unix_socket_directories = '/tmp'", -+ repltok); -+ - #if DEF_PGPORT != 5432 - snprintf(repltok, sizeof(repltok), "#port = %d", DEF_PGPORT); - conflines = replace_token(conflines, "#port = 5432", repltok); -diff -Naur postgresql-9.2.3.orig/src/bin/pg_ctl/pg_ctl.c postgresql-9.2.3/src/bin/pg_ctl/pg_ctl.c ---- postgresql-9.2.3.orig/src/bin/pg_ctl/pg_ctl.c 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/bin/pg_ctl/pg_ctl.c 2013-02-06 19:57:37.147794028 -0500 -@@ -559,7 +559,7 @@ - hostaddr = optlines[LOCK_FILE_LINE_LISTEN_ADDR - 1]; - - /* -- * While unix_socket_directory can accept relative -+ * While unix_socket_directories can accept relative - * directories, libpq's host parameter must have a - * leading slash to indicate a socket directory. So, - * ignore sockdir if it's relative, and try to use TCP -diff -Naur postgresql-9.2.3.orig/src/include/libpq/libpq.h postgresql-9.2.3/src/include/libpq/libpq.h ---- postgresql-9.2.3.orig/src/include/libpq/libpq.h 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/include/libpq/libpq.h 2013-02-06 19:57:37.147794028 -0500 -@@ -44,12 +44,12 @@ - /* - * prototypes for functions in pqcomm.c - */ --extern int StreamServerPort(int family, char *hostName, -- unsigned short portNumber, char *unixSocketName, pgsocket ListenSocket[], -- int MaxListen); -+extern int StreamServerPort(int family, char *hostName, -+ unsigned short portNumber, char *unixSocketDir, -+ pgsocket ListenSocket[], int MaxListen); - extern int StreamConnection(pgsocket server_fd, Port *port); - extern void StreamClose(pgsocket sock); --extern void TouchSocketFile(void); -+extern void TouchSocketFiles(void); - extern void pq_init(void); - extern void pq_comm_reset(void); - extern int pq_getbytes(char *s, size_t len); -diff -Naur postgresql-9.2.3.orig/src/include/miscadmin.h postgresql-9.2.3/src/include/miscadmin.h ---- postgresql-9.2.3.orig/src/include/miscadmin.h 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/include/miscadmin.h 2013-02-06 19:57:37.148793934 -0500 -@@ -411,7 +411,7 @@ - * 2 data directory path - * 3 postmaster start timestamp (time_t representation) - * 4 port number -- * 5 socket directory path (empty on Windows) -+ * 5 first Unix socket directory path (empty if none) - * 6 first listen_address (IP address or "*"; empty if no TCP port) - * 7 shared memory key (not present on Windows) - * -@@ -429,8 +429,9 @@ - #define LOCK_FILE_LINE_SHMEM_KEY 7 - - extern void CreateDataDirLockFile(bool amPostmaster); --extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster); --extern void TouchSocketLockFile(void); -+extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster, -+ const char *socketDir); -+extern void TouchSocketLockFiles(void); - extern void AddToDataDirLockFile(int target_line, const char *str); - extern void ValidatePgVersion(const char *path); - extern void process_shared_preload_libraries(void); -diff -Naur postgresql-9.2.3.orig/src/include/postmaster/postmaster.h postgresql-9.2.3/src/include/postmaster/postmaster.h ---- postgresql-9.2.3.orig/src/include/postmaster/postmaster.h 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/include/postmaster/postmaster.h 2013-02-06 19:57:37.148793934 -0500 -@@ -19,7 +19,7 @@ - extern int PostPortNumber; - extern int Unix_socket_permissions; - extern char *Unix_socket_group; --extern char *UnixSocketDir; -+extern char *Unix_socket_directories; - extern char *ListenAddresses; - extern bool ClientAuthInProgress; - extern int PreAuthDelay; -diff -Naur postgresql-9.2.3.orig/src/include/utils/builtins.h postgresql-9.2.3/src/include/utils/builtins.h ---- postgresql-9.2.3.orig/src/include/utils/builtins.h 2013-02-04 16:28:13.000000000 -0500 -+++ postgresql-9.2.3/src/include/utils/builtins.h 2013-02-06 19:57:37.149793843 -0500 -@@ -754,6 +754,8 @@ - extern List *textToQualifiedNameList(text *textval); - extern bool SplitIdentifierString(char *rawstring, char separator, - List **namelist); -+extern bool SplitDirectoriesString(char *rawstring, char separator, -+ List **namelist); - extern Datum replace_text(PG_FUNCTION_ARGS); - extern text *replace_text_regexp(text *src_text, void *regexp, - text *replace_text, bool glob); -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/html-stamp postgresql-9.2.3/doc/src/sgml/html-stamp ---- postgresql-9.2.3.orig/doc/src/sgml/html-stamp 2013-02-04 16:36:12.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/html-stamp 2013-02-06 19:57:37.149793843 -0500 -@@ -0,0 +1 @@ -+hack -diff -Naur postgresql-9.2.3.orig/doc/src/sgml/man-stamp postgresql-9.2.3/doc/src/sgml/man-stamp ---- postgresql-9.2.3.orig/doc/src/sgml/man-stamp 2013-02-04 16:37:18.000000000 -0500 -+++ postgresql-9.2.3/doc/src/sgml/man-stamp 2013-02-06 19:57:37.149793843 -0500 -@@ -0,0 +1 @@ -+hack diff --git a/postgresql-python3.patch b/postgresql-python3.patch deleted file mode 100644 index f67383f..0000000 --- a/postgresql-python3.patch +++ /dev/null @@ -1,62 +0,0 @@ -This won't be needed in 9.2.1 and later. - - -commit 770556d6c69c4edf219d4ace2e4fb29a1f2c35df -Author: Tom Lane -Date: Sat Sep 8 17:39:02 2012 -0400 - - Adjust PL/Python regression tests some more for Python 3.3. - - Commit 2cfb1c6f77734db81b6e74bcae630f93b94f69be fixed some issues caused - by Python 3.3 choosing to iterate through dict entries in a different order - than before. But here's another one: the test cases adjusted here made two - bad entries in a dict and expected the one complained of would always be - the same. - - Possibly this should be back-patched further than 9.2, but there seems - little point unless the earlier fix is too. - -diff --git a/src/pl/plpython/expected/plpython_trigger.out b/src/pl/plpython/expected/plpython_trigger.out -index 4c46b2b..25060b0 100644 ---- a/src/pl/plpython/expected/plpython_trigger.out -+++ b/src/pl/plpython/expected/plpython_trigger.out -@@ -476,7 +476,7 @@ DROP TRIGGER stupid_trigger6 ON trigger_test; - -- TD keys not corresponding to row columns - CREATE FUNCTION stupid7() RETURNS trigger - AS $$ -- TD["new"] = {'a': 'foo', 'b': 'bar'} -+ TD["new"] = {'v': 'foo', 'a': 'bar'} - return "MODIFY"; - $$ LANGUAGE plpythonu; - CREATE TRIGGER stupid_trigger7 -@@ -490,7 +490,7 @@ DROP TRIGGER stupid_trigger7 ON trigger_test; - -- Unicode variant - CREATE FUNCTION stupid7u() RETURNS trigger - AS $$ -- TD["new"] = {u'a': 'foo', u'b': 'bar'} -+ TD["new"] = {u'v': 'foo', u'a': 'bar'} - return "MODIFY" - $$ LANGUAGE plpythonu; - CREATE TRIGGER stupid_trigger7 -diff --git a/src/pl/plpython/sql/plpython_trigger.sql b/src/pl/plpython/sql/plpython_trigger.sql -index 2a4859f..9727f44 100644 ---- a/src/pl/plpython/sql/plpython_trigger.sql -+++ b/src/pl/plpython/sql/plpython_trigger.sql -@@ -253,7 +253,7 @@ DROP TRIGGER stupid_trigger6 ON trigger_test; - - CREATE FUNCTION stupid7() RETURNS trigger - AS $$ -- TD["new"] = {'a': 'foo', 'b': 'bar'} -+ TD["new"] = {'v': 'foo', 'a': 'bar'} - return "MODIFY"; - $$ LANGUAGE plpythonu; - -@@ -270,7 +270,7 @@ DROP TRIGGER stupid_trigger7 ON trigger_test; - - CREATE FUNCTION stupid7u() RETURNS trigger - AS $$ -- TD["new"] = {u'a': 'foo', u'b': 'bar'} -+ TD["new"] = {u'v': 'foo', u'a': 'bar'} - return "MODIFY" - $$ LANGUAGE plpythonu; - diff --git a/postgresql-var-run-socket.patch b/postgresql-var-run-socket.patch index 22b8a0c..3a7eddf 100644 --- a/postgresql-var-run-socket.patch +++ b/postgresql-var-run-socket.patch @@ -12,16 +12,14 @@ server package update, without requiring any existing postgresql.conf to be updated. (Of course, a user who dislikes this behavior can still override it via postgresql.conf.) -This patch must be applied after postgresql-multi-sockets.patch, at -least until 9.3 when that will be part of the upstream package. - -diff -Naur postgresql-9.2.2.sockets/contrib/pg_upgrade/test.sh postgresql-9.2.2/contrib/pg_upgrade/test.sh ---- postgresql-9.2.2.sockets/contrib/pg_upgrade/test.sh 2013-01-03 17:33:45.581567466 -0500 -+++ postgresql-9.2.2/contrib/pg_upgrade/test.sh 2013-01-03 17:40:22.923364917 -0500 -@@ -78,6 +78,12 @@ - rm -rf "$logdir" - mkdir "$logdir" +diff --git a/contrib/pg_upgrade/test.sh b/contrib/pg_upgrade/test.sh +index 30bc527..4e8f6a4 100644 +--- a/contrib/pg_upgrade/test.sh ++++ b/contrib/pg_upgrade/test.sh +@@ -107,6 +107,12 @@ done + EXTRA_REGRESS_OPTS="$EXTRA_REGRESS_OPTS --port=$PGPORT" + export EXTRA_REGRESS_OPTS +# we want the Unix sockets in $temp_root +PGHOST=$temp_root @@ -32,10 +30,11 @@ diff -Naur postgresql-9.2.2.sockets/contrib/pg_upgrade/test.sh postgresql-9.2.2/ # enable echo so the user can see what is being executed set -x -diff -Naur postgresql-9.2.2.sockets/src/backend/utils/misc/guc.c postgresql-9.2.2/src/backend/utils/misc/guc.c ---- postgresql-9.2.2.sockets/src/backend/utils/misc/guc.c 2013-01-03 17:37:56.632977951 -0500 -+++ postgresql-9.2.2/src/backend/utils/misc/guc.c 2013-01-03 17:38:30.183271588 -0500 -@@ -2901,7 +2901,7 @@ +diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c +index a055231..20b8c87 100644 +--- a/src/backend/utils/misc/guc.c ++++ b/src/backend/utils/misc/guc.c +@@ -2929,7 +2929,7 @@ static struct config_string ConfigureNamesString[] = }, &Unix_socket_directories, #ifdef HAVE_UNIX_SOCKETS @@ -44,10 +43,11 @@ diff -Naur postgresql-9.2.2.sockets/src/backend/utils/misc/guc.c postgresql-9.2. #else "", #endif -diff -Naur postgresql-9.2.2.sockets/src/bin/initdb/initdb.c postgresql-9.2.2/src/bin/initdb/initdb.c ---- postgresql-9.2.2.sockets/src/bin/initdb/initdb.c 2013-01-03 17:37:56.633977974 -0500 -+++ postgresql-9.2.2/src/bin/initdb/initdb.c 2013-01-03 17:38:30.185271611 -0500 -@@ -1007,7 +1007,7 @@ +diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c +index 5fc7291..d871341 100644 +--- a/src/bin/initdb/initdb.c ++++ b/src/bin/initdb/initdb.c +@@ -1203,7 +1203,7 @@ setup_config(void) #ifdef HAVE_UNIX_SOCKETS snprintf(repltok, sizeof(repltok), "#unix_socket_directories = '%s'", @@ -56,9 +56,10 @@ diff -Naur postgresql-9.2.2.sockets/src/bin/initdb/initdb.c postgresql-9.2.2/src #else snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''"); #endif -diff -Naur postgresql-9.2.2.sockets/src/include/pg_config_manual.h postgresql-9.2.2/src/include/pg_config_manual.h ---- postgresql-9.2.2.sockets/src/include/pg_config_manual.h 2012-12-03 15:16:10.000000000 -0500 -+++ postgresql-9.2.2/src/include/pg_config_manual.h 2013-01-03 17:38:30.185271611 -0500 +diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h +index 02bcd92..8aaf58b 100644 +--- a/src/include/pg_config_manual.h ++++ b/src/include/pg_config_manual.h @@ -144,7 +144,7 @@ * here's where to twiddle it. You can also override this at runtime * with the postmaster's -k switch. @@ -68,10 +69,11 @@ diff -Naur postgresql-9.2.2.sockets/src/include/pg_config_manual.h postgresql-9. /* * The random() function is expected to yield values between 0 and -diff -Naur postgresql-9.2.2.sockets/src/test/regress/pg_regress.c postgresql-9.2.2/src/test/regress/pg_regress.c ---- postgresql-9.2.2.sockets/src/test/regress/pg_regress.c 2012-12-03 15:16:10.000000000 -0500 -+++ postgresql-9.2.2/src/test/regress/pg_regress.c 2013-01-03 17:38:30.186271622 -0500 -@@ -772,7 +772,7 @@ +diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c +index b632326..943165c 100644 +--- a/src/test/regress/pg_regress.c ++++ b/src/test/regress/pg_regress.c +@@ -772,7 +772,7 @@ initialize_environment(void) if (hostname != NULL) doputenv("PGHOST", hostname); else @@ -80,7 +82,7 @@ diff -Naur postgresql-9.2.2.sockets/src/test/regress/pg_regress.c postgresql-9.2 unsetenv("PGHOSTADDR"); if (port != -1) { -@@ -2246,7 +2246,7 @@ +@@ -2249,7 +2249,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc */ header(_("starting postmaster")); snprintf(buf, sizeof(buf), diff --git a/postgresql.service b/postgresql.service index 4a55a66..aa63e1a 100644 --- a/postgresql.service +++ b/postgresql.service @@ -15,7 +15,7 @@ # This will override the setting appearing below. # Note: changing PGPORT or PGDATA will typically require adjusting SELinux -# configuration as well; see /usr/share/doc/postgresql-*/README.rpm-dist. +# configuration as well; see /usr/share/doc/postgresql/README.rpm-dist. # Note: do not use a PGDATA pathname containing spaces, or you will # break postgresql-setup. diff --git a/postgresql.spec b/postgresql.spec index c74b933..868581d 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -58,9 +58,9 @@ Summary: PostgreSQL client programs Name: postgresql -%global majorversion 9.2 -Version: 9.2.4 -Release: 11%{?dist} +%global majorversion 9.3 +Version: 9.3.0 +Release: 1%{?dist} # The PostgreSQL license is very similar to other MIT licenses, but the OSI # recognizes it as an independent license, so we do as well. @@ -75,8 +75,8 @@ Url: http://www.postgresql.org/ # in-place upgrade of an old database. In most cases it will not be critical # that this be kept up with the latest minor release of the previous series; # but update when bugs affecting pg_dump output are fixed. -%global prevversion 9.1.9 -%global prevmajorversion 9.1 +%global prevversion 9.2.4 +%global prevmajorversion 9.2 Source0: ftp://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2 # The PDF file is generated by generate-pdf.sh, which see for comments @@ -102,29 +102,9 @@ Patch1: rpm-pgsql.patch Patch2: postgresql-logging.patch Patch3: postgresql-perl-rpath.patch Patch4: postgresql-config-comment.patch -Patch5: postgresql-multi-sockets.patch -Patch6: postgresql-var-run-socket.patch - -# Comments for these patches are in the patch files. -Patch8: postgresql-man.patch - -# Build even with Perl 5.18+ -# ~> upstream (035a5e1e8c34) -Patch9: postgresql-9.2.4-perl-5.18.patch - -# Add support for atomic operations TAS/S_UNLOCK in aarch64. -# ~> upstream (612ecf311b) -# ~> #970661 -Patch10: postgresql-9.2.4-aarch64-atomic.patch -Patch11: postgresql-9.2.4-aarch64-atomic-upgrade.patch - -# When user complicates access of 'postgres' user to the database, the -# pg_upgrade can left the old server running - and re-run of pg_upgrade thus -# does not help. This patch stops the server in described scenario properly. -# ~> not yet upstream, patch by Bruce Momjian: -# ~> http://www.postgresql.org/message-id/20130812193347.GD12510@momjian.us -# ~> #896161 -Patch12: postgresql-9.2.4-upgrade-and-perm-problems.patch +Patch5: postgresql-var-run-socket.patch +Patch6: postgresql-man.patch +Patch100: postgresql-aarch64-atomic-upgrade.patch BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk BuildRequires: perl(ExtUtils::Embed), perl-devel @@ -352,10 +332,6 @@ benchmarks. %patch4 -p1 %patch5 -p1 %patch6 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch12 -p1 # We used to run autoconf here, but there's no longer any real need to, # since Postgres ships with a reasonably modern configure script. @@ -374,9 +350,8 @@ tar xfj %{SOURCE3} cp -p config/config.guess postgresql-%{prevversion}/config/config.guess cp -p config/config.sub postgresql-%{prevversion}/config/config.sub -pushd postgresql-%{prevversion} -%patch11 -p2 -popd +# apply once SOURCE3 is extracted +%patch100 -d postgresql-%{prevversion} -p1 %endif # remove .gitignore files to ensure none get into the RPMs (bug #642210) @@ -886,6 +861,7 @@ fi %{_bindir}/pg_config %{_bindir}/pg_dump %{_bindir}/pg_dumpall +%{_bindir}/pg_isready %{_bindir}/pg_restore %{_bindir}/psql %{_bindir}/reindexdb @@ -900,6 +876,7 @@ fi %{_mandir}/man1/pg_config.* %{_mandir}/man1/pg_dump.* %{_mandir}/man1/pg_dumpall.* +%{_mandir}/man1/pg_isready.* %{_mandir}/man1/pg_restore.* %{_mandir}/man1/psql.* %{_mandir}/man1/reindexdb.* @@ -941,6 +918,7 @@ fi %{_datadir}/pgsql/extension/pgcrypto* %{_datadir}/pgsql/extension/pgrowlocks* %{_datadir}/pgsql/extension/pgstattuple* +%{_datadir}/pgsql/extension/postgres_fdw* %{_datadir}/pgsql/extension/refint* %{_datadir}/pgsql/extension/seg* %{_datadir}/pgsql/extension/tablefunc* @@ -976,11 +954,12 @@ fi %{_libdir}/pgsql/passwordcheck.so %{_libdir}/pgsql/pg_buffercache.so %{_libdir}/pgsql/pg_freespacemap.so +%{_libdir}/pgsql/pg_stat_statements.so %{_libdir}/pgsql/pg_trgm.so %{_libdir}/pgsql/pgcrypto.so %{_libdir}/pgsql/pgrowlocks.so %{_libdir}/pgsql/pgstattuple.so -%{_libdir}/pgsql/pg_stat_statements.so +%{_libdir}/pgsql/postgres_fdw.so %{_libdir}/pgsql/refint.so %{_libdir}/pgsql/seg.so %{_libdir}/pgsql/tablefunc.so @@ -989,6 +968,7 @@ fi %{_libdir}/pgsql/timetravel.so %{_libdir}/pgsql/tsearch2.so %{_libdir}/pgsql/unaccent.so +%{_libdir}/pgsql/worker_spi.so %if %selinux %{_datadir}/pgsql/contrib/sepgsql.sql %{_libdir}/pgsql/sepgsql.so @@ -1010,6 +990,7 @@ fi %{_bindir}/pg_standby %{_bindir}/pg_test_fsync %{_bindir}/pg_test_timing +%{_bindir}/pg_xlogdump %{_bindir}/pgbench %{_bindir}/vacuumlo %{_mandir}/man1/oid2name.* @@ -1017,6 +998,7 @@ fi %{_mandir}/man1/pg_standby.* %{_mandir}/man1/pg_test_fsync.* %{_mandir}/man1/pg_test_timing.* +%{_mandir}/man1/pg_xlogdump.1.gz %{_mandir}/man1/pgbench.* %{_mandir}/man1/vacuumlo.* %{_mandir}/man3/dblink* @@ -1089,6 +1071,7 @@ fi %{_libdir}/libecpg_compat.so %{_libdir}/libpgtypes.so %{_libdir}/pgsql/pgxs/ +%{_libdir}/pkgconfig/*.pc %{_mandir}/man1/ecpg.* %{_mandir}/man3/SPI_* @@ -1137,6 +1120,10 @@ fi %endif %changelog +* Tue Sep 10 2013 Pavel Raiskup - 9.3.0-1 +- update to 9.3 major version per release notes: + http://www.postgresql.org/docs/9.3/static/release-9-3.html + * Thu Aug 15 2013 Pavel Raiskup - 9.2.4-11 - upgrade: stop old server in case of permissions problem (#896161) diff --git a/sources b/sources index 4657dc6..89277b0 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ 6ee5bb53b97da7c6ad9cb0825d3300dd postgresql-9.2.4.tar.bz2 -64f70057a3a153e8e237d0c79ccc63e9 postgresql-9.2.4-US.pdf -6b5ea53dde48fcd79acfc8c196b83535 postgresql-9.1.9.tar.bz2 +3d148088eed8b394705ae8df13b6d389 postgresql-9.3.0-US.pdf +09aee56f3a15ce4a7ea32044fb845b53 postgresql-9.3.0.tar.bz2