Commit c737a2e5 authored by Andrew Dunstan's avatar Andrew Dunstan

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.
parent c2b51cf1
...@@ -76,14 +76,18 @@ mkdir "$logdir" ...@@ -76,14 +76,18 @@ mkdir "$logdir"
# Clear out any environment vars that might cause libpq to connect to # Clear out any environment vars that might cause libpq to connect to
# the wrong postmaster (cf pg_regress.c) # the wrong postmaster (cf pg_regress.c)
unset PGDATABASE #
unset PGUSER # Some shells, such as NetBSD's, return non-zero from unset if the variable
unset PGSERVICE # is already unset. Since we are operating under 'set -e', this causes the
unset PGSSLMODE # script to fail. To guard against this, set them all to an empty string first.
unset PGREQUIRESSL PGDATABASE=""; unset PGDATABASE
unset PGCONNECT_TIMEOUT PGUSER=""; unset PGUSER
unset PGHOST PGSERVICE=""; unset PGSERVICE
unset PGHOSTADDR PGSSLMODE="" unset PGSSLMODE
PGREQUIRESSL=""; unset PGREQUIRESSL
PGCONNECT_TIMEOUT=""; unset PGCONNECT_TIMEOUT
PGHOST="" unset PGHOST
PGHOSTADDR=""; unset PGHOSTADDR
# Select a non-conflicting port number, similarly to pg_regress.c # Select a non-conflicting port number, similarly to pg_regress.c
PG_VERSION_NUM=`grep '#define PG_VERSION_NUM' $newsrc/src/include/pg_config.h | awk '{print $3}'` PG_VERSION_NUM=`grep '#define PG_VERSION_NUM' $newsrc/src/include/pg_config.h | awk '{print $3}'`
......
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