summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-12-01 17:24:15 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2012-12-01 17:24:15 -0500
commit9009ec051554bac71e7eac701936743de52c2322 (patch)
treeeae3a9b66195efddd1ae082f500244b5cee86166
parentb10b1fa86169f6cc8ecb7f7005a67e59d3280e02 (diff)
downloadpostgresql-9009ec051554bac71e7eac701936743de52c2322.tar.gz
Prevent passing gmake's environment variables down through pg_regress.
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
-rw-r--r--src/test/regress/pg_regress.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 154e7692f0..ae3c8d3e69 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -768,6 +768,19 @@ initialize_environment(void)
}
/*
+ * 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
*/
tmp = malloc(strlen(temp_install) + 32 + strlen(bindir));