postgres.git / summary / log / commit / refs

commit    9060cb96805e0d3cfe74c0919feb5e2ce1034ffc
Author:   Andrew Dunstan <andrew@dunslane.net>
Date:     Mon Oct 28 15:45:50 2013 +0000
First released in: 9.4.0, 9.2.6, 9.3.2

    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.


contrib/pg_upgrade/test.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/contrib/pg_upgrade/test.sh b/contrib/pg_upgrade/test.sh index 313701c4f23..3be0304d16f 100644 --- a/contrib/pg_upgrade/test.sh +++ b/contrib/pg_upgrade/test.sh @@ -67,14 +67,20 @@ PGDATA="$BASE_PGDATA.old" export PGDATA rm -rf "$BASE_PGDATA" "$PGDATA" -unset PGDATABASE -unset PGUSER -unset PGSERVICE -unset PGSSLMODE -unset PGREQUIRESSL -unset PGCONNECT_TIMEOUT -unset PGHOST -unset PGHOSTADDR +# Clear out any environment vars that might cause libpq to connect to +# the wrong postmaster (cf pg_regress.c) +# +# Some shells, such as NetBSD's, return non-zero from unset if the variable +# is already unset. Since we are operating under 'set -e', this causes the +# script to fail. To guard against this, set them all to an empty string first. +PGDATABASE=""; unset PGDATABASE +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 rm -rf "$logdir" [parent: 4da24f12e633]