Re: [HACKERS] [PATCH] make -jN check fails / unset MAKEFLAGS in pg_regress.c

2012-12-01 Thread Tom Lane
Andres Freund and...@2ndquadrant.com writes:
 Trivially updated patch attached.

Applied, thanks.

regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] make -jN check fails / unset MAKEFLAGS in pg_regress.c

2012-11-30 Thread Robert Haas
On Thu, Nov 29, 2012 at 8:50 AM, Andres Freund and...@2ndquadrant.com wrote:
 Hi,

 Currently make -jN check fails during creating temporary installation
 with:
 make[1]: *** read jobs pipe: Invalid argument.  Stop.
 make[1]: *** Waiting for unfinished jobs
 make[2]: warning: jobserver unavailable: using -j1.  Add `+' to parent make 
 rule.
 in install.log.

 This is due to pg_regress invoking make while being invoked by make
 itself. gnu make internally sets the MAKEFLAGS environment variable to
 remember arguments. The problem in this case is that it contains
 --jobserver-fds=4,5 which makes the pg_regress invoked make think its
 running as a make child process.

 Now the problem obviously can be worked around by using make -jN 
 make check instead of make -j16 check but I several times now have
 spent time trying to figure out what I broke so it sees sensible to
 fix this.

 Any arguments against doing so?

 The attached patch also resets the MAKELEVEL environment variable for
 good measure. I haven't seen any indication that its needed, but it
 feelds safer ;)

Seems reasonable to me.

But shouldn't the comment in the patch say to be certain the child
DOESN'T notice the make above us?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] make -jN check fails / unset MAKEFLAGS in pg_regress.c

2012-11-30 Thread Andres Freund
On 2012-11-30 14:41:14 -0500, Robert Haas wrote:
 On Thu, Nov 29, 2012 at 8:50 AM, Andres Freund and...@2ndquadrant.com wrote:
  Hi,
 
  Currently make -jN check fails during creating temporary installation
  with:
  make[1]: *** read jobs pipe: Invalid argument.  Stop.
  make[1]: *** Waiting for unfinished jobs
  make[2]: warning: jobserver unavailable: using -j1.  Add `+' to parent make 
  rule.
  in install.log.
 
  This is due to pg_regress invoking make while being invoked by make
  itself. gnu make internally sets the MAKEFLAGS environment variable to
  remember arguments. The problem in this case is that it contains
  --jobserver-fds=4,5 which makes the pg_regress invoked make think its
  running as a make child process.
 
  Now the problem obviously can be worked around by using make -jN 
  make check instead of make -j16 check but I several times now have
  spent time trying to figure out what I broke so it sees sensible to
  fix this.
 
  Any arguments against doing so?
 
  The attached patch also resets the MAKELEVEL environment variable for
  good measure. I haven't seen any indication that its needed, but it
  feelds safer ;)

 Seems reasonable to me.

 But shouldn't the comment in the patch say to be certain the child
 DOESN'T notice the make above us?

Yes. obviously. Stupid, errr, fingers.

Thanks for spotting.

Andres Freund

--
 Andres Freund http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] make -jN check fails / unset MAKEFLAGS in pg_regress.c

2012-11-30 Thread Andres Freund
 Yes. obviously. Stupid, errr, fingers.

This time round it really was fatfingering the wrong key after having
been climbing for 4h. Really.

Trivially updated patch attached.

-- 
 Andres Freund http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services
From 52fad5c7e645b514cdf23feddf08a3cd690363be Mon Sep 17 00:00:00 2001
From: Andres Freund and...@anarazel.de
Date: Thu, 29 Nov 2012 14:49:42 +0100
Subject: [PATCH] Unset MAKEFLAGS in pg_regress.c to hide the knowledge that
 its invoked by make from submakes

Make stores some flags in the MAKEFLAGS variable to pass arguments to its own
children. If we are invoked by make that makes the make invoked by us think
it's part of the parallel make invoking us and tries to communicate with the
toplevel make. Which fails.
---
 src/test/regress/pg_regress.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 5a656f2..842eba1 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -783,6 +783,18 @@ initialize_environment(void)
 		}
 
 		/*
+		 * make stores some flags in the MAKEFLAGS variable to pass arguments
+		 * to its own children. If we are invoked by make that makes the make
+		 * invoked by us think its part of the parallel make invoking us and
+		 * 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));
-- 
1.7.12.289.g0ce9864.dirty


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] [PATCH] make -jN check fails / unset MAKEFLAGS in pg_regress.c

2012-11-29 Thread Andres Freund
Hi,

Currently make -jN check fails during creating temporary installation
with:
make[1]: *** read jobs pipe: Invalid argument.  Stop.
make[1]: *** Waiting for unfinished jobs
make[2]: warning: jobserver unavailable: using -j1.  Add `+' to parent make 
rule.
in install.log.

This is due to pg_regress invoking make while being invoked by make
itself. gnu make internally sets the MAKEFLAGS environment variable to
remember arguments. The problem in this case is that it contains
--jobserver-fds=4,5 which makes the pg_regress invoked make think its
running as a make child process.

Now the problem obviously can be worked around by using make -jN 
make check instead of make -j16 check but I several times now have
spent time trying to figure out what I broke so it sees sensible to
fix this.

Any arguments against doing so?

The attached patch also resets the MAKELEVEL environment variable for
good measure. I haven't seen any indication that its needed, but it
feelds safer ;)

Greetings,

Andres Freund

-- 
 Andres Freund http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services
From 53d560d707964017ec0ef8cdd9d4a00632f3feec Mon Sep 17 00:00:00 2001
From: Andres Freund and...@anarazel.de
Date: Thu, 29 Nov 2012 14:49:42 +0100
Subject: [PATCH] Unset MAKEFLAGS in pg_regress.c to hide the knowledge that
 its invoked by make from submakes

Make stores some flags in the MAKEFLAGS variable to pass arguments to its own
children. If we are invoked by make that makes the make invoked by us think its
part of the parallel make invoking us and tries to communicate with the
toplevel make. Which fails.
---
 src/test/regress/pg_regress.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 81e7b69..1a25252 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -783,6 +783,18 @@ initialize_environment(void)
 		}
 
 		/*
+		 * make stores some flags in the MAKEFLAGS variable to pass arguments
+		 * to its own children. If we are invoked by make that makes the make
+		 * invoked by us think its part of the parallel make invoking us and
+		 * 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 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));
-- 
1.7.12.289.g0ce9864.dirty


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers