Bug 202277

Summary: [patch] src/Makefile.inc1 - fix buildworld from 9.3-stable to 10.2-stable (Malformed conditional after r285814)
Product: Base System Reporter: John Hein <jcfyecrayz>
Component: miscAssignee: Glen Barber <gjb>
Status: Closed FIXED    
Severity: Affects Some People CC: jcfyecrayz, re
Priority: --- Keywords: patch
Version: 10.2-STABLEFlags: jcfyecrayz: mfc-stable10?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
use ${MAKE} in Makefile.inc1 for setting REVISION & BRANCH none

Description John Hein 2015-08-12 20:40:44 UTC
Created attachment 159819 [details]
use ${MAKE} in Makefile.inc1 for setting REVISION & BRANCH

When updating from 9.3-stable to 10.2-stable, you get:

make buildworld
 .
 .
"/usr/src/release/Makefile.vagrant", line 27: Malformed conditional ()
"/usr/src/release/Makefile.vagrant", line 27: Malformed conditional ()
"/usr/src/release/Makefile.vagrant", line 29: if-less endif
"/usr/src/release/Makefile.vagrant", line 27: Malformed conditional ()
"/usr/src/release/Makefile.vagrant", line 29: if-less endif
"/usr/src/release/Makefile.vagrant", line 27: Malformed conditional ()
"/usr/src/release/Makefile.vagrant", line 29: if-less endif
"/usr/src/release/Makefile.vagrant", line 31: if-less endif
"/usr/src/release/Makefile.vagrant", line 64: Malformed conditional (azure == "virtualbox")
"/usr/src/release/Makefile.vagrant", line 67: if-less elif
"/usr/src/release/Makefile.vagrant", line 70: if-less endif
"/usr/src/release/Makefile.vagrant", line 74: Malformed conditional (azure == "virtualbox")
"/usr/src/release/Makefile.vagrant", line 76: if-less elif
"/usr/src/release/Makefile.vagrant", line 78: if-less endif
"/usr/src/release/Makefile.vagrant", line 64: Malformed conditional (ec2 == "virtualbox")
"/usr/src/release/Makefile.vagrant", line 67: if-less elif
 .
 .

This is caused by these lines from Makefile.inc1 (at least r286673 and earlier):

REVISION!=      make -C ${SRCDIR}/release -V REVISION
BRANCH!=        make -C ${SRCDIR}/release -V BRANCH


This uses fmake (9.3-stable's /usr/bin/make) and release/Makefile.vagrant (included by release/Makefile.vm which is included by release/Makefile) has some bmake-isms in it (as of July 23's r285814 on 10-stable).

Makefile.vagrant could be scrubbed of bmake-isms, but it's just as easy and probably better to use ${MAKE} instead of 'make' in Makefile.inc1.  The patch I'll attach uses that approach (can commit to HEAD and MFC to 10-stable).
Comment 1 John Hein 2015-08-12 21:09:06 UTC
Looks like this affects 10.2-release, too.
Comment 2 John Hein 2015-08-12 21:13:46 UTC
CC'ing re@ - seems like it may be of interest for upcoming 10.2 release.
Comment 3 Glen Barber freebsd_committer freebsd_triage 2015-08-12 21:21:54 UTC
We'll have to issue an EN for this after 10.2-RELEASE is out.  The release builds are already in progress.
Comment 4 Glen Barber freebsd_committer freebsd_triage 2015-08-13 16:37:15 UTC
Investigating further, it appears this is a non-fatal issue when upgrading, and produces (still unfortunate) noise during invocation.

The patch you propose is already in head, but was never MFC'd to stable/10.

We will pursue an EN for this after the 10.2-RELEASE is announced.  Thank you for the report.
Comment 5 John Hein 2015-08-13 18:49:11 UTC
Thanks for looking into it.
Yes, I see it was fixed in r262670 on head back in March 2014.

I agree it's non-fatal (for the build) - I should have mentioned that in the original report (sorry).

But I didn't track down the ramifications of a VERSION string that is missing the REVISION & BRANCH elements.  Or rather I briefly saw that VERSION is passed in the environment to some sub-makes, but I didn't find any places where it was referenced beyond that (quick grep of Makefile* & *.mk in the tree didn't show anything that would use the Makefile.inc1 VERSION string, but I may have missed it).
Comment 6 Glen Barber freebsd_committer freebsd_triage 2015-08-13 18:56:22 UTC
(In reply to John Hein from comment #5)
> Thanks for looking into it.

No problem.  Thank you for reporting the issue.

> Yes, I see it was fixed in r262670 on head back in March 2014.
> 
> I agree it's non-fatal (for the build) - I should have mentioned that in the
> original report (sorry).
> 

That's fine.

> But I didn't track down the ramifications of a VERSION string that is
> missing the REVISION & BRANCH elements.  Or rather I briefly saw that
> VERSION is passed in the environment to some sub-makes, but I didn't find
> any places where it was referenced beyond that (quick grep of Makefile* &
> *.mk in the tree didn't show anything that would use the Makefile.inc1
> VERSION string, but I may have missed it).

It has zero rammifications for the world and kernel build that I was able to determine.  As far as I am able to tell, it is only used for setting the OSRELEASE for the actual release build, when the installation images are renamed from 'disc1.iso' to 'FreeBSD-10.2-RELEASE-amd64-disc1.iso', for example.
Comment 7 John Hein 2015-08-13 20:18:17 UTC
Okay.  It looks like release/Makefile sets OSRELEASE from newvers.sh rather than any VERSION string in the environment.  Maybe there's somewhere VERSION is used, but I can't find it right now [1].  If not, maybe all that stuff (REVISION, BRANCH, VERSION) can be removed.  I'll see if I can find out where it came from with some archaeology.

[1] release/scripts/atlas-upload.sh could be slightly confused by VERSION in the environment.  It should probably unset its internal variables early.
Comment 8 John Hein 2015-08-13 20:21:16 UTC
VERSION was added in 2008 by jb@ (r179233).
Comment 9 John Hein 2015-08-13 21:23:13 UTC
So VERSION is encoded in ctf sections in the kernel somehow.  I can't find where that is implemented right now, but commit logs for Makefile.inc1 talk about it.
Comment 10 John Hein 2015-08-13 22:14:47 UTC
I see it now... sys.mk adds '-L VERSION' to CTFFLAGS which tells ctfconvert to read the label from the environment variable VERSION.

So the upshot of the missing bits of VERSION is that if you're building with CTF and updating from 9 to 10, a somewhat unexpected label will live in the ctf section of object files, missing REVISION & BRANCH.  If your kernel & world object files are all built that way, everything would be consistent.  But it's not clear to me how these malformed ctf labels would make a big difference when doing dtrace things anyway.  All in all, it seems like it won't hurt anything seriously.  If that's so, I don't know if I would bother with an errata notice.  That said, it'd be nice if someone could merge the ${MAKE} change from head to 10/stable - if nothing else, just to avoid the extra noise in the build.
Comment 11 Glen Barber freebsd_committer freebsd_triage 2015-08-13 22:23:06 UTC
(In reply to John Hein from comment #10)
> I see it now... sys.mk adds '-L VERSION' to CTFFLAGS which tells ctfconvert
> to read the label from the environment variable VERSION.
> 
> So the upshot of the missing bits of VERSION is that if you're building with
> CTF and updating from 9 to 10, a somewhat unexpected label will live in the
> ctf section of object files, missing REVISION & BRANCH.  If your kernel &
> world object files are all built that way, everything would be consistent. 
> But it's not clear to me how these malformed ctf labels would make a big
> difference when doing dtrace things anyway.  All in all, it seems like it
> won't hurt anything seriously.  If that's so, I don't know if I would bother
> with an errata notice.  That said, it'd be nice if someone could merge the
> ${MAKE} change from head to 10/stable - if nothing else, just to avoid the
> extra noise in the build.

The change for stable/10 will be made shortly.  The EN for 10.2-RELEASE will be for the 's/make/${MAKE}/' change, so the noisy output is suppressed in an updated releng/10.2 upgrade from 9.x and earlier.
Comment 12 commit-hook freebsd_committer freebsd_triage 2015-08-13 22:30:22 UTC
A commit references this bug:

Author: gjb
Date: Thu Aug 13 22:29:27 UTC 2015
New revision: 286746
URL: https://svnweb.freebsd.org/changeset/base/286746

Log:
  MFC r262670 (marcel):
    Use ${MAKE} so that we always use the same version/implementation
    of make(1).

  PR:		202277
  Submitted by:	John Hein
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/10/
  stable/10/Makefile.inc1
Comment 13 Glen Barber freebsd_committer freebsd_triage 2015-08-18 22:06:25 UTC
Fixed in 10.2-RELEASE as FreeBSD-EN-15:11.toolchain.

Thank you, again, for the report.