diff options
| author | Andrew Dunstan | 2013-10-28 15:45:50 +0000 |
|---|---|---|
| committer | Andrew Dunstan | 2013-10-28 15:51:44 +0000 |
| commit | bd04dfba9f7e10274a6b2558e57e274403161373 (patch) | |
| tree | 4ff4d4587672bee5ed9fe6a7b9b8dfba0d2fe594 | |
| parent | 01c1b1aa25149674f9347f9d915533a53c33eff6 (diff) | |
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.
| -rw-r--r-- | contrib/pg_upgrade/test.sh | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/contrib/pg_upgrade/test.sh b/contrib/pg_upgrade/test.sh index 30bc5274317..a109b5b1963 100644 --- a/contrib/pg_upgrade/test.sh +++ b/contrib/pg_upgrade/test.sh @@ -76,14 +76,18 @@ mkdir "$logdir" # Clear out any environment vars that might cause libpq to connect to # the wrong postmaster (cf pg_regress.c) -unset PGDATABASE -unset PGUSER -unset PGSERVICE -unset PGSSLMODE -unset PGREQUIRESSL -unset PGCONNECT_TIMEOUT -unset PGHOST -unset PGHOSTADDR +# +# 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 # 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}'` |
