]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Ignore more environment variables in pg_regress.c
authorMichael Paquier <michael@paquier.xyz>
Sun, 13 Jun 2021 11:08:00 +0000 (20:08 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sun, 13 Jun 2021 11:08:00 +0000 (20:08 +0900)
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

src/test/perl/TestLib.pm
src/test/regress/pg_regress.c

index 7f8e9f32e055c5b7bf9b2a3d09d97625450acfc3..727469bc68632e67f8160732bd1b2015da00a299 100644 (file)
@@ -56,6 +56,7 @@ BEGIN
        delete $ENV{LC_ALL};
        $ENV{LC_MESSAGES} = 'C';
 
+       # This list should be kept in sync with pg_regress.c.
        my @envkeys = qw (
          PGCLIENTENCODING
          PGCONNECT_TIMEOUT
index 38b53d2aa3e7f696ef71192e758be6702088798a..682cea88e0906c386e5e0366afd8c43df041c21a 100644 (file)
@@ -799,14 +799,32 @@ 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.
                 */
+               /* PGCLIENTENCODING, see above */
+               unsetenv("PGCONNECT_TIMEOUT");
+               unsetenv("PGDATA");
                unsetenv("PGDATABASE");
-               unsetenv("PGUSER");
+               unsetenv("PGGSSLIB");
+               /* PGHOSTADDR, see below */
+               unsetenv("PGKRBSRVNAME");
+               unsetenv("PGPASSFILE");
+               unsetenv("PGPASSWORD");
+               unsetenv("PGREQUIREPEER");
+               unsetenv("PGREQUIRESSL");
                unsetenv("PGSERVICE");
+               unsetenv("PGSERVICEFILE");
+               unsetenv("PGSSLCERT");
+               unsetenv("PGSSLCRL");
+               unsetenv("PGSSLKEY");
                unsetenv("PGSSLMODE");
-               unsetenv("PGREQUIRESSL");
-               unsetenv("PGCONNECT_TIMEOUT");
-               unsetenv("PGDATA");
+               unsetenv("PGSSLROOTCERT");
+               unsetenv("PGTARGETSESSIONATTRS");
+               unsetenv("PGUSER");
+               /* PGPORT, see below */
+               /* PGHOST, see below */
+
 #ifdef HAVE_UNIX_SOCKETS
                if (hostname != NULL)
                        doputenv("PGHOST", hostname);