From 1cd49a06e5e67fbd1bc60706014d22ae6a71da9f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 3 Jan 2013 18:37:36 -0500 Subject: [PATCH] Fix bugs 891531 and 891547 --- postgresql-setup | 1 + postgresql-upgrade-test.patch | 55 +++++++++++++++++++++++++++++++++ postgresql-var-run-socket.patch | 36 +++++++-------------- postgresql.spec | 13 ++++++-- 4 files changed, 79 insertions(+), 26 deletions(-) create mode 100644 postgresql-upgrade-test.patch diff --git a/postgresql-setup b/postgresql-setup index 132ef78..e566106 100644 --- a/postgresql-setup +++ b/postgresql-setup @@ -91,6 +91,7 @@ perform_initdb(){ mkdir "$PGDATA/pg_log" chown postgres:postgres "$PGDATA/pg_log" chmod go-rwx "$PGDATA/pg_log" + [ -x /sbin/restorecon ] && /sbin/restorecon "$PGDATA/pg_log" if [ -f "$PGDATA/PG_VERSION" ] then diff --git a/postgresql-upgrade-test.patch b/postgresql-upgrade-test.patch new file mode 100644 index 0000000..28add1b --- /dev/null +++ b/postgresql-upgrade-test.patch @@ -0,0 +1,55 @@ +Back-patch upstream fix to suppress creation of postmaster's TCP socket +during pg_upgrade testing. This will be in 9.2.3 and later. + + +diff -Naur postgresql-9.2.2.orig/contrib/pg_upgrade/test.sh postgresql-9.2.2/contrib/pg_upgrade/test.sh +--- postgresql-9.2.2.orig/contrib/pg_upgrade/test.sh 2012-12-03 15:16:10.000000000 -0500 ++++ postgresql-9.2.2/contrib/pg_upgrade/test.sh 2013-01-03 17:33:45.581567466 -0500 +@@ -17,6 +17,13 @@ + + testhost=`uname -s` + ++case $testhost in ++ MINGW*) LISTEN_ADDRESSES="localhost" ;; ++ *) LISTEN_ADDRESSES="" ;; ++esac ++ ++POSTMASTER_OPTS="-F -c listen_addresses=$LISTEN_ADDRESSES" ++ + temp_root=$PWD/tmp_check + + if [ "$1" = '--install' ]; then +@@ -71,10 +78,11 @@ + rm -rf "$logdir" + mkdir "$logdir" + ++# enable echo so the user can see what is being executed + set -x + + $oldbindir/initdb +-$oldbindir/pg_ctl start -l "$logdir/postmaster1.log" -w ++$oldbindir/pg_ctl start -l "$logdir/postmaster1.log" -o "$POSTMASTER_OPTS" -w + if "$MAKE" -C "$oldsrc" installcheck; then + pg_dumpall -f "$temp_root"/dump1.sql || pg_dumpall1_status=$? + if [ "$newsrc" != "$oldsrc" ]; then +@@ -117,7 +125,7 @@ + + pg_upgrade -d "${PGDATA}.old" -D "${PGDATA}" -b "$oldbindir" -B "$bindir" + +-pg_ctl start -l "$logdir/postmaster2.log" -w ++pg_ctl start -l "$logdir/postmaster2.log" -o "$POSTMASTER_OPTS" -w + + case $testhost in + MINGW*) cmd /c analyze_new_cluster.bat ;; +@@ -126,6 +134,11 @@ + + pg_dumpall -f "$temp_root"/dump2.sql || pg_dumpall2_status=$? + pg_ctl -m fast stop ++ ++# no need to echo commands anymore ++set +x ++echo ++ + if [ -n "$pg_dumpall2_status" ]; then + echo "pg_dumpall of post-upgrade database cluster failed" + exit 1 diff --git a/postgresql-var-run-socket.patch b/postgresql-var-run-socket.patch index 305dc02..22b8a0c 100644 --- a/postgresql-var-run-socket.patch +++ b/postgresql-var-run-socket.patch @@ -17,9 +17,9 @@ 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 2012-12-03 15:16:10.000000000 -0500 -+++ postgresql-9.2.2/contrib/pg_upgrade/test.sh 2012-12-04 14:34:04.661476094 -0500 -@@ -71,10 +71,14 @@ +--- 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" @@ -27,26 +27,14 @@ diff -Naur postgresql-9.2.2.sockets/contrib/pg_upgrade/test.sh postgresql-9.2.2/ +PGHOST=$temp_root +export PGHOST + ++POSTMASTER_OPTS="$POSTMASTER_OPTS -c unix_socket_directories='$PGHOST'" ++ + # enable echo so the user can see what is being executed set -x - $oldbindir/initdb --$oldbindir/pg_ctl start -l "$logdir/postmaster1.log" -w -+$oldbindir/pg_ctl start -l "$logdir/postmaster1.log" -o "-c unix_socket_directories='$PGHOST'" -w - if "$MAKE" -C "$oldsrc" installcheck; then - pg_dumpall -f "$temp_root"/dump1.sql || pg_dumpall1_status=$? - if [ "$newsrc" != "$oldsrc" ]; then -@@ -117,7 +121,7 @@ - - pg_upgrade -d "${PGDATA}.old" -D "${PGDATA}" -b "$oldbindir" -B "$bindir" - --pg_ctl start -l "$logdir/postmaster2.log" -w -+pg_ctl start -l "$logdir/postmaster2.log" -o "-c unix_socket_directories='$PGHOST'" -w - - case $testhost in - MINGW*) cmd /c analyze_new_cluster.bat ;; 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 2012-12-04 14:25:57.578967623 -0500 -+++ postgresql-9.2.2/src/backend/utils/misc/guc.c 2012-12-04 14:34:04.663476214 -0500 +--- 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 @@ }, &Unix_socket_directories, @@ -57,8 +45,8 @@ diff -Naur postgresql-9.2.2.sockets/src/backend/utils/misc/guc.c postgresql-9.2. "", #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 2012-12-04 14:25:57.579967636 -0500 -+++ postgresql-9.2.2/src/bin/initdb/initdb.c 2012-12-04 14:34:04.665476326 -0500 +--- 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 @@ #ifdef HAVE_UNIX_SOCKETS @@ -70,7 +58,7 @@ diff -Naur postgresql-9.2.2.sockets/src/bin/initdb/initdb.c postgresql-9.2.2/src #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 2012-12-04 14:34:04.665476326 -0500 ++++ postgresql-9.2.2/src/include/pg_config_manual.h 2013-01-03 17:38:30.185271611 -0500 @@ -144,7 +144,7 @@ * here's where to twiddle it. You can also override this at runtime * with the postmaster's -k switch. @@ -82,7 +70,7 @@ 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 2012-12-04 14:34:04.666476378 -0500 ++++ postgresql-9.2.2/src/test/regress/pg_regress.c 2013-01-03 17:38:30.186271622 -0500 @@ -772,7 +772,7 @@ if (hostname != NULL) doputenv("PGHOST", hostname); diff --git a/postgresql.spec b/postgresql.spec index b94d35e..b335e59 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -58,7 +58,7 @@ Summary: PostgreSQL client programs Name: postgresql %global majorversion 9.2 Version: 9.2.2 -Release: 2%{?dist} +Release: 3%{?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. @@ -101,7 +101,8 @@ 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 +Patch6: postgresql-upgrade-test.patch +Patch7: postgresql-var-run-socket.patch BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk BuildRequires: perl(ExtUtils::Embed), perl-devel @@ -329,6 +330,7 @@ benchmarks. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -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. @@ -1085,6 +1087,13 @@ fi %endif %changelog +* Thu Jan 3 2013 Tom Lane 9.2.2-3 +- Prevent creation of TCP socket during pg_upgrade regression test, so that + concurrent RPM builds on the same machine won't fail +Resolves: #891531 +- Make sure $PGDATA/pg_log/ gets the right SELinux label in postgresql-setup +Resolves: #891547 + * Wed Dec 19 2012 Tom Lane 9.2.2-2 - Make building of plpython3 dependent on Fedora version, per guidelines Resolves: #888419