Skip to content

Commit 1df6bee

Browse files
committed
Ignore more environment variables in pg_regress.c
This is similar to the work done in 8279f68 for TestLib.pm, where environment variables set may cause unwanted failures if using a temporary installation with pg_regress. The list of variables reset is adjusted in each stable branch depending on what is supported. Comments are added to remember that the lists in TestLib.pm and pg_regress.c had better be kept in sync. Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/YMNR9GYDn+fHlMta@paquier.xyz Backpatch-through: 9.6
1 parent c1ffbbc commit 1df6bee

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/test/perl/TestLib.pm

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ BEGIN
5151
delete $ENV{LC_ALL};
5252
$ENV{LC_MESSAGES} = 'C';
5353

54+
# This list should be kept in sync with pg_regress.c.
5455
my @envkeys = qw (
5556
PGCLIENTENCODING
5657
PGCONNECT_TIMEOUT

src/test/regress/pg_regress.c

+21-4
Original file line numberDiff line numberDiff line change
@@ -797,14 +797,31 @@ initialize_environment(void)
797797
* we also use psql's -X switch consistently, so that ~/.psqlrc files
798798
* won't mess things up.) Also, set PGPORT to the temp port, and set
799799
* PGHOST depending on whether we are using TCP or Unix sockets.
800+
*
801+
* This list should be kept in sync with TestLib.pm.
800802
*/
803+
/* PGCLIENTENCODING, see above */
804+
unsetenv("PGCONNECT_TIMEOUT");
805+
unsetenv("PGDATA");
801806
unsetenv("PGDATABASE");
802-
unsetenv("PGUSER");
807+
unsetenv("PGGSSLIB");
808+
/* PGHOSTADDR, see below */
809+
unsetenv("PGKRBSRVNAME");
810+
unsetenv("PGPASSFILE");
811+
unsetenv("PGPASSWORD");
812+
unsetenv("PGREQUIREPEER");
813+
unsetenv("PGREQUIRESSL");
803814
unsetenv("PGSERVICE");
815+
unsetenv("PGSERVICEFILE");
816+
unsetenv("PGSSLCERT");
817+
unsetenv("PGSSLCRL");
818+
unsetenv("PGSSLKEY");
804819
unsetenv("PGSSLMODE");
805-
unsetenv("PGREQUIRESSL");
806-
unsetenv("PGCONNECT_TIMEOUT");
807-
unsetenv("PGDATA");
820+
unsetenv("PGSSLROOTCERT");
821+
unsetenv("PGUSER");
822+
/* PGPORT, see below */
823+
/* PGHOST, see below */
824+
808825
#ifdef HAVE_UNIX_SOCKETS
809826
if (hostname != NULL)
810827
doputenv("PGHOST", hostname);

0 commit comments

Comments
 (0)