summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2021-06-13 11:07:39 +0000
committerMichael Paquier2021-06-13 11:07:39 +0000
commita9e0b3b08fe38d5e31f03ea96859ff5e413d4a38 (patch)
treebd4cb5232baa80b3d68d679dce84fe381d67b464
parentf452aaf7d4a96cfcecd6c60ccd294ffe7b8ea088 (diff)
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/[email protected] Backpatch-through: 9.6
-rw-r--r--src/test/perl/TestLib.pm1
-rw-r--r--src/test/regress/pg_regress.c32
2 files changed, 29 insertions, 4 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 47d7f31e94c..26fbe08d4be 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -104,6 +104,7 @@ BEGIN
delete $ENV{LC_ALL};
$ENV{LC_MESSAGES} = 'C';
+ # This list should be kept in sync with pg_regress.c.
my @envkeys = qw (
PGCHANNELBINDING
PGCLIENTENCODING
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index e04d365258d..05296f7ee1d 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -819,14 +819,38 @@ initialize_environment(void)
* we also use psql's -X switch consistently, so that ~/.psqlrc files
* won't mess things up.) Also, set PGPORT to the temp port, and set
* PGHOST depending on whether we are using TCP or Unix sockets.
+ *
+ * This list should be kept in sync with TestLib.pm.
*/
+ unsetenv("PGCHANNELBINDING");
+ /* PGCLIENTENCODING, see above */
+ unsetenv("PGCONNECT_TIMEOUT");
+ unsetenv("PGDATA");
unsetenv("PGDATABASE");
- unsetenv("PGUSER");
+ unsetenv("PGGSSENCMODE");
+ unsetenv("PGGSSLIB");
+ /* PGHOSTADDR, see below */
+ unsetenv("PGKRBSRVNAME");
+ unsetenv("PGPASSFILE");
+ unsetenv("PGPASSWORD");
+ unsetenv("PGREQUIREPEER");
+ unsetenv("PGREQUIRESSL");
unsetenv("PGSERVICE");
+ unsetenv("PGSERVICEFILE");
+ unsetenv("PGSSLCERT");
+ unsetenv("PGSSLCRL");
+ unsetenv("PGSSLCRLDIR");
+ unsetenv("PGSSLKEY");
+ unsetenv("PGSSLMAXPROTOCOLVERSION");
+ unsetenv("PGSSLMINPROTOCOLVERSION");
unsetenv("PGSSLMODE");
- unsetenv("PGREQUIRESSL");
- unsetenv("PGCONNECT_TIMEOUT");
- unsetenv("PGDATA");
+ unsetenv("PGSSLROOTCERT");
+ unsetenv("PGSSLSNI");
+ unsetenv("PGTARGETSESSIONATTRS");
+ unsetenv("PGUSER");
+ /* PGPORT, see below */
+ /* PGHOST, see below */
+
#ifdef HAVE_UNIX_SOCKETS
if (hostname != NULL)
setenv("PGHOST", hostname, 1);