Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a9e0b3b

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 f452aaf commit a9e0b3b

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

src/test/perl/TestLib.pm

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ BEGIN
104104
delete $ENV{LC_ALL};
105105
$ENV{LC_MESSAGES} = 'C';
106106

107+
# This list should be kept in sync with pg_regress.c.
107108
my @envkeys = qw (
108109
PGCHANNELBINDING
109110
PGCLIENTENCODING

src/test/regress/pg_regress.c

+28-4
Original file line numberDiff line numberDiff line change
@@ -819,14 +819,38 @@ initialize_environment(void)
819819
* we also use psql's -X switch consistently, so that ~/.psqlrc files
820820
* won't mess things up.) Also, set PGPORT to the temp port, and set
821821
* PGHOST depending on whether we are using TCP or Unix sockets.
822+
*
823+
* This list should be kept in sync with TestLib.pm.
822824
*/
825+
unsetenv("PGCHANNELBINDING");
826+
/* PGCLIENTENCODING, see above */
827+
unsetenv("PGCONNECT_TIMEOUT");
828+
unsetenv("PGDATA");
823829
unsetenv("PGDATABASE");
824-
unsetenv("PGUSER");
830+
unsetenv("PGGSSENCMODE");
831+
unsetenv("PGGSSLIB");
832+
/* PGHOSTADDR, see below */
833+
unsetenv("PGKRBSRVNAME");
834+
unsetenv("PGPASSFILE");
835+
unsetenv("PGPASSWORD");
836+
unsetenv("PGREQUIREPEER");
837+
unsetenv("PGREQUIRESSL");
825838
unsetenv("PGSERVICE");
839+
unsetenv("PGSERVICEFILE");
840+
unsetenv("PGSSLCERT");
841+
unsetenv("PGSSLCRL");
842+
unsetenv("PGSSLCRLDIR");
843+
unsetenv("PGSSLKEY");
844+
unsetenv("PGSSLMAXPROTOCOLVERSION");
845+
unsetenv("PGSSLMINPROTOCOLVERSION");
826846
unsetenv("PGSSLMODE");
827-
unsetenv("PGREQUIRESSL");
828-
unsetenv("PGCONNECT_TIMEOUT");
829-
unsetenv("PGDATA");
847+
unsetenv("PGSSLROOTCERT");
848+
unsetenv("PGSSLSNI");
849+
unsetenv("PGTARGETSESSIONATTRS");
850+
unsetenv("PGUSER");
851+
/* PGPORT, see below */
852+
/* PGHOST, see below */
853+
830854
#ifdef HAVE_UNIX_SOCKETS
831855
if (hostname != NULL)
832856
setenv("PGHOST", hostname, 1);

0 commit comments

Comments
 (0)