Bug 185636 - [PATCH] devel/gmake: implicit gmake re-executions miss MAKEFLAGS with make-3.82
Summary: [PATCH] devel/gmake: implicit gmake re-executions miss MAKEFLAGS with make-3.82
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: autotools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-10 11:50 UTC by jcharbon
Modified: 2014-01-29 18:30 UTC (History)
0 users

See Also:


Attachments
file.diff (846 bytes, patch)
2014-01-10 11:50 UTC, jcharbon
no flags Details | Diff
gmake-testcase.tar.gz (425 bytes, application/x-gzip)
2014-01-10 12:27 UTC, jcharbon
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jcharbon 2014-01-10 11:50:00 UTC
A bug introduced in gmake 3.82 (and not present in gmake 3.81) drives this unexpected behaviour:

When gmake automatically restarts itself because one of its includes is updated, the "MAKEFLAGS" environment variable is no more honoured.

This issue is described here:

http://savannah.gnu.org/bugs/?30723

And it is fixed in various Linux distros that use gmake 3.82:

ArchLinux:

https://projects.archlinux.org/svntogit/packages.git/tree/trunk/make-3.82-bug30723.patch?h=packages/make&id=a8335b891e635b8173e37155af2554ec345f181f

Fedora:

http://pkgs.fedoraproject.org/cgit/make.git/tree/make-3.82-bugfixes.patch#n39

Fix: Apply the joined patch to devel/gmake port

Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-01-10 11:50:10 UTC
Responsible Changed
From-To: freebsd-ports-bugs->autotools

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 jcharbon 2014-01-10 12:27:07 UTC
  If you want to reproduce the issue with the joined tarball 
(gmake-testcase.tar.gz) example:

  With current devel/gmake:

$ tar zxvf /tmp/gmake-testcase.tar.gz
x gmake-testcase/
x gmake-testcase/foo/
x gmake-testcase/Makefile
x gmake-testcase/config.make
x gmake-testcase/foo/Makefile
$ cd gmake-testcase/
$ gmake x=1
before: x=1 origin: command line
after: x=1 origin: command line
rm -f foo/foo
gmake -C foo
before: x=1 origin: command line
after: x=1 origin: command line
gmake[1]: Entering directory `/home/jcharbon/tmp/gmake-testcase/foo'
touch foo
gmake[1]: Leaving directory `/home/jcharbon/tmp/gmake-testcase/foo'
before: x=1 origin: environment
after: x="x should not be overriden when defined on command line" 
origin: file
gmake[1]: Entering directory `/home/jcharbon/tmp/gmake-testcase/foo'
gmake[1]: `foo' is up to date.
gmake[1]: Leaving directory `/home/jcharbon/tmp/gmake-testcase/foo'
rm -f foo/foo
$

  With patched devel/gmake:

$ gmake x=1
before: x=1 origin: command line
after: x=1 origin: command line
rm -f foo/foo
gmake -C foo
before: x=1 origin: command line
after: x=1 origin: command line
gmake[1]: Entering directory `/home/jcharbon/tmp/gmake-testcase/foo'
touch foo
gmake[1]: Leaving directory `/home/jcharbon/tmp/gmake-testcase/foo'
before: x=1 origin: command line
after: x=1 origin: command line
gmake[1]: Entering directory `/home/jcharbon/tmp/gmake-testcase/foo'
gmake[1]: `foo' is up to date.
gmake[1]: Leaving directory `/home/jcharbon/tmp/gmake-testcase/foo'
rm -f foo/foo

  Much better.

--
Julien
Comment 3 dfilter service freebsd_committer freebsd_triage 2014-01-29 18:21:25 UTC
Author: ade
Date: Wed Jan 29 18:21:18 2014
New Revision: 341768
URL: http://svnweb.freebsd.org/changeset/ports/341768
QAT: https://qat.redports.org/buildarchive/r341768/

Log:
  Address a reasonably obscure issue with automatic restarting and
  MAKEFLAGS.  No PORTREVISION bump in this case since the confusion
  and mass hysteria is simply not worth it.
  
  PR:		185636
  Submitted by:	Julien Charbon <jcharbon@verisign.com>

Added:
  head/devel/gmake/files/patch-main.c   (contents, props changed)

Added: head/devel/gmake/files/patch-main.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gmake/files/patch-main.c	Wed Jan 29 18:21:18 2014	(r341768)
@@ -0,0 +1,17 @@
+When gmake automatically restart itself because one of its includes is updated,
+the "MAKEFLAGS" environment variable is no more honoured.
+
+http://savannah.gnu.org/bugs/?30723
+
+diff -rU3 -N make-3.82.orig/main.c make-3.82/main.c
+--- main.c.orig	2010-07-19 07:10:53.000000000 +0000
++++ main.c	2014-01-10 10:55:32.000000000 +0000
+@@ -2093,7 +2093,7 @@
+             const char *pv = define_makeflags (1, 1);
+             char *p = alloca (sizeof ("MAKEFLAGS=") + strlen (pv) + 1);
+             sprintf (p, "MAKEFLAGS=%s", pv);
+-            putenv (p);
++            putenv (allocated_variable_expand (p));
+           }
+ 
+ 	  if (ISDB (DB_BASIC))
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Ade Lovett freebsd_committer freebsd_triage 2014-01-29 18:21:32 UTC
State Changed
From-To: open->closed

Committed, thanks.