1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +03:00

Work around NetBSD shell issue in pg_upgrade test script.

The NetBSD shell apparently returns non-zero from an unset command if
the variable is already unset. This matters when, as in pg_upgrade's
test.sh, we are working under 'set -e'. To protect against this, we
first set the PG variables to an empty string before unsetting them
completely.

Error found on buildfarm member coypu, solution from Rémi Zara.
This commit is contained in:
Andrew Dunstan
2013-10-28 11:45:50 -04:00
parent 4da24f12e6
commit 9060cb9680

View File

@ -67,14 +67,20 @@ PGDATA="$BASE_PGDATA.old"
export PGDATA export PGDATA
rm -rf "$BASE_PGDATA" "$PGDATA" rm -rf "$BASE_PGDATA" "$PGDATA"
unset PGDATABASE # Clear out any environment vars that might cause libpq to connect to
unset PGUSER # the wrong postmaster (cf pg_regress.c)
unset PGSERVICE #
unset PGSSLMODE # Some shells, such as NetBSD's, return non-zero from unset if the variable
unset PGREQUIRESSL # is already unset. Since we are operating under 'set -e', this causes the
unset PGCONNECT_TIMEOUT # script to fail. To guard against this, set them all to an empty string first.
unset PGHOST PGDATABASE=""; unset PGDATABASE
unset PGHOSTADDR PGUSER=""; unset PGUSER
PGSERVICE=""; unset PGSERVICE
PGSSLMODE="" unset PGSSLMODE
PGREQUIRESSL=""; unset PGREQUIRESSL
PGCONNECT_TIMEOUT=""; unset PGCONNECT_TIMEOUT
PGHOST="" unset PGHOST
PGHOSTADDR=""; unset PGHOSTADDR
logdir=$PWD/log logdir=$PWD/log
rm -rf "$logdir" rm -rf "$logdir"