Commit 0c0908d9 authored by Tom Lane's avatar Tom Lane

Be more paranoid about quoting in pg_upgrade's test script.

Double-quote $PGDATA in "find" commands introduced by commit da9b580d,
in case that path contains spaces or other special characters.

Adjust a few other places so that quoting is done more consistently.
None of the others are actual bugs AFAICS, but it's confusing to readers
if the same thing is done differently in different places.

Noted by Tels.

Discussion: https://postgr.es/m/c96303c04c360bbedaa04f90f515745b.squirrel@sm.webmail.pair.com
parent 986127e3
...@@ -65,7 +65,7 @@ case $testhost in ...@@ -65,7 +65,7 @@ case $testhost in
;; ;;
esac esac
POSTMASTER_OPTS="-F -c listen_addresses=$LISTEN_ADDRESSES -k \"$PGHOST\"" POSTMASTER_OPTS="-F -c listen_addresses=\"$LISTEN_ADDRESSES\" -k \"$PGHOST\""
export PGHOST export PGHOST
# don't rely on $PWD here, as old shells don't set it # don't rely on $PWD here, as old shells don't set it
...@@ -107,8 +107,8 @@ newsrc=`cd ../../.. && pwd` ...@@ -107,8 +107,8 @@ newsrc=`cd ../../.. && pwd`
PATH=$bindir:$PATH PATH=$bindir:$PATH
export PATH export PATH
BASE_PGDATA=$temp_root/data BASE_PGDATA="$temp_root/data"
PGDATA="$BASE_PGDATA.old" PGDATA="${BASE_PGDATA}.old"
export PGDATA export PGDATA
rm -rf "$BASE_PGDATA" "$PGDATA" rm -rf "$BASE_PGDATA" "$PGDATA"
...@@ -224,17 +224,17 @@ if [ -n "$pg_dumpall1_status" ]; then ...@@ -224,17 +224,17 @@ if [ -n "$pg_dumpall1_status" ]; then
exit 1 exit 1
fi fi
PGDATA=$BASE_PGDATA PGDATA="$BASE_PGDATA"
standard_initdb 'initdb' standard_initdb 'initdb'
pg_upgrade $PG_UPGRADE_OPTS -d "${PGDATA}.old" -D "${PGDATA}" -b "$oldbindir" -B "$bindir" -p "$PGPORT" -P "$PGPORT" pg_upgrade $PG_UPGRADE_OPTS -d "${PGDATA}.old" -D "$PGDATA" -b "$oldbindir" -B "$bindir" -p "$PGPORT" -P "$PGPORT"
# make sure all directories and files have group permissions, on Unix hosts # make sure all directories and files have group permissions, on Unix hosts
# Windows hosts don't support Unix-y permissions. # Windows hosts don't support Unix-y permissions.
case $testhost in case $testhost in
MINGW*) ;; MINGW*) ;;
*) if [ `find ${PGDATA} -type f ! -perm 640 | wc -l` -ne 0 ]; then *) if [ `find "$PGDATA" -type f ! -perm 640 | wc -l` -ne 0 ]; then
echo "files in PGDATA with permission != 640"; echo "files in PGDATA with permission != 640";
exit 1; exit 1;
fi ;; fi ;;
...@@ -242,7 +242,7 @@ esac ...@@ -242,7 +242,7 @@ esac
case $testhost in case $testhost in
MINGW*) ;; MINGW*) ;;
*) if [ `find ${PGDATA} -type d ! -perm 750 | wc -l` -ne 0 ]; then *) if [ `find "$PGDATA" -type d ! -perm 750 | wc -l` -ne 0 ]; then
echo "directories in PGDATA with permission != 750"; echo "directories in PGDATA with permission != 750";
exit 1; exit 1;
fi ;; fi ;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment