v6-0004-Fix-pg_upgrade-test-for-Unix-domain-sockets-on-Wi.patch

text/plain

Filename: v6-0004-Fix-pg_upgrade-test-for-Unix-domain-sockets-on-Wi.patch
Type: text/plain
Part: 3
Message: Re: Unix-domain socket support on Windows

Patch

Format: format-patch
Series: patch v6-0004
Subject: Fix pg_upgrade test for Unix-domain sockets on Windows
File+
src/bin/pg_upgrade/test.sh 6 5
From a88d5a7c7a58161c6d414bd7600099f7d81f5b53 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 11 Feb 2020 19:53:27 +0100
Subject: [PATCH v6 4/5] Fix pg_upgrade test for Unix-domain sockets on Windows

The previous code passed "localhost" to postgres -k, which only
happened to work because Windows used to ignore the -k argument value
altogether.  We instead need to pass an empty string to get the
desired effect.
---
 src/bin/pg_upgrade/test.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/bin/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh
index 6430610d48..10a28d8133 100644
--- a/src/bin/pg_upgrade/test.sh
+++ b/src/bin/pg_upgrade/test.sh
@@ -39,14 +39,14 @@ testhost=`uname -s | sed 's/^MSYS/MINGW/'`
 case $testhost in
 	MINGW*)
 		LISTEN_ADDRESSES="localhost"
+		PG_REGRESS_SOCKET_DIR=""
 		PGHOST=localhost
 		;;
 	*)
 		LISTEN_ADDRESSES=""
 		# Select a socket directory.  The algorithm is from the "configure"
 		# script; the outcome mimics pg_regress.c:make_temp_sockdir().
-		PGHOST=$PG_REGRESS_SOCK_DIR
-		if [ "x$PGHOST" = x ]; then
+		if [ x"$PG_REGRESS_SOCKET_DIR" = x ]; then
 			set +e
 			dir=`(umask 077 &&
 				  mktemp -d /tmp/pg_upgrade_check-XXXXXX) 2>/dev/null`
@@ -59,14 +59,15 @@ case $testhost in
 				fi
 			fi
 			set -e
-			PGHOST=$dir
-			trap 'rm -rf "$PGHOST"' 0
+			PG_REGRESS_SOCKET_DIR=$dir
+			trap 'rm -rf "$PG_REGRESS_SOCKET_DIR"' 0
 			trap 'exit 3' 1 2 13 15
 		fi
+		PGHOST=$PG_REGRESS_SOCKET_DIR
 		;;
 esac
 
-POSTMASTER_OPTS="-F -c listen_addresses=\"$LISTEN_ADDRESSES\" -k \"$PGHOST\""
+POSTMASTER_OPTS="-F -c listen_addresses=\"$LISTEN_ADDRESSES\" -k \"$PG_REGRESS_SOCKET_DIR\""
 export PGHOST
 
 # don't rely on $PWD here, as old shells don't set it
-- 
2.25.0