]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Prevent passing gmake's environment variables down through pg_regress.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 1 Dec 2012 22:24:01 +0000 (17:24 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 1 Dec 2012 22:24:01 +0000 (17:24 -0500)
When we do "make install" to create a temp installation, we don't want
that instance of make to try to communicate with any instance of make
that might be calling us.  This is known to cause problems if the
upper make has a -jN flag, and in principle could cause problems even
without that.  Unset the relevant environment variables to prevent such
issues.

Andres Freund

src/test/regress/pg_regress.c

index c8b45c93f20121998083df966d22942663f91010..502299a52e2772c9dc84e4791484742129d760c2 100644 (file)
@@ -791,6 +791,19 @@ initialize_environment(void)
                        doputenv("PGPORT", s);
                }
 
+               /*
+                * GNU make stores some flags in the MAKEFLAGS environment variable to
+                * pass arguments to its own children.  If we are invoked by make,
+                * that causes the make invoked by us to think its part of the make
+                * task invoking us, and so it tries to communicate with the toplevel
+                * make.  Which fails.
+                *
+                * Unset the variable to protect against such problems.  We also reset
+                * MAKELEVEL to be certain the child doesn't notice the make above us.
+                */
+               unsetenv("MAKEFLAGS");
+               unsetenv("MAKELEVEL");
+
                /*
                 * Adjust path variables to point into the temp-install tree
                 */