From d766e4a812f2aa78bfc946449620c31e416958a4 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Tue, 1 Apr 2025 15:45:40 +0900 Subject: [PATCH] Test: skip inaccessible Unix socket directories. Commit 182b65bfc allows to use multiple Unix socket directories: /tmp and /var/run/postgresql. However if the system does not have accessible /var/run/postgresql, pgpool_setup fails unless $PGSOCKET_DIR is explicitly set. Instead of failing, this commit allows pgpool_setup to skip inaccessible directories. Backpatch-through: v4.5 --- src/test/pgpool_setup.in | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/test/pgpool_setup.in b/src/test/pgpool_setup.in index 00510037f..4eff7dd73 100644 --- a/src/test/pgpool_setup.in +++ b/src/test/pgpool_setup.in @@ -76,8 +76,24 @@ PGPOOLDIR=${PGPOOLDIR:-"@@PGPOOL_CONFIG_DIR@@"} PGBIN=${PGBIN:-"@@PGSQL_BIN_DIR@@"} # LD_LIBRARY_PATH LPATH=${PGLIB:-"@@PGSQL_LIB_DIR@@"} -# unix socket directory +# unix socket directories PGSOCKET_DIR=${PGSOCKET_DIR:-"/tmp,/var/run/postgresql"} +# remove inaccessible diretories from PGSOCKET_DIR +tmp=`echo $PGSOCKET_DIR|sed "s/,/ /"` +dir="" +first=true +for i in $tmp +do + if [ -w $i ];then + if [ $first != "true" ];then + dir="$dir,$i" + else + dir=$i + fi + fi + first=false +done +PGSOCKET_DIR=$dir # initdb args INITDBARG="--no-locale -E UTF_8" # Use replication slot -- 2.39.5