Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5252285

Browse files
committed
Don't say 'export PGHOST' or 'export PGPORT' unless we actually define
those variables. Some shells will invent an empty-string definition in this case, which is not what we want.
1 parent e41b8a0 commit 5252285

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/test/regress/pg_regress.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.14 2000/12/11 19:00:33 tgl Exp $
2+
# $Header: /cvsroot/pgsql/src/test/regress/Attic/pg_regress.sh,v 1.15 2000/12/31 18:38:44 tgl Exp $
33

44
me=`basename $0`
55
: ${TMPDIR=/tmp}
@@ -89,9 +89,6 @@ unset top_builddir
8989
unset temp_install
9090
unset multibyte
9191

92-
export PGHOST
93-
export PGPORT
94-
9592
dbname=regression
9693
hostname=localhost
9794

@@ -138,9 +135,11 @@ do
138135
shift;;
139136
--host=*)
140137
PGHOST=`expr "x$1" : "x--host=\(.*\)"`
138+
export PGHOST
141139
shift;;
142140
--port=*)
143141
PGPORT=`expr "x$1" : "x--port=\(.*\)"`
142+
export PGPORT
144143
shift;;
145144
--user=*)
146145
PGUSER=`expr "x$1" : "x--user=\(.*\)"`
@@ -276,10 +275,12 @@ then
276275
PGDATA=$temp_install/data
277276
if [ "$unix_sockets" = no ]; then
278277
PGHOST=$hostname
278+
export PGHOST
279279
else
280280
unset PGHOST
281281
fi
282282
PGPORT=65432
283+
export PGPORT
283284

284285
# ----------
285286
# Set up shared library paths, needed by psql and pg_encoding
@@ -357,7 +358,10 @@ then
357358
else # not temp-install
358359

359360
# If Unix sockets are not available, use the local host by default.
360-
[ "$unix_sockets" = no ] && ${PGHOST=$hostname}
361+
if [ "$unix_sockets" = no ]; then
362+
PGHOST=$hostname
363+
export PGHOST
364+
fi
361365

362366
if [ -n "$PGPORT" ]; then
363367
port_info="port $PGPORT"

0 commit comments

Comments
 (0)