From nobody@FreeBSD.org  Wed Oct 24 16:46:37 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 01687E1F
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Oct 2012 16:46:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id DCE628FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Oct 2012 16:46:36 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q9OGkadP064037
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Oct 2012 16:46:36 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id q9OGka3K064036;
	Wed, 24 Oct 2012 16:46:36 GMT
	(envelope-from nobody)
Message-Id: <201210241646.q9OGka3K064036@red.freebsd.org>
Date: Wed, 24 Oct 2012 16:46:36 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] emulators/open-vm-tools: fix clang compile problem with -Wformat-security when built from PORTS_MODULES
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         173030
>Category:       kern
>Synopsis:       [atf] [patch] emulators/open-vm-tools: fix clang compile problem with -Wformat-security when built from PORTS_MODULES
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 24 16:50:01 UTC 2012
>Closed-Date:    Fri Jul 12 11:51:03 UTC 2013
>Last-Modified:  Fri Jul 12 11:51:03 UTC 2013
>Originator:     Garrett Cooper
>Release:        10-CURRENT
>Organization:
EMC Isilon
>Environment:
FreeBSD fallout-atf-current.local 10.0-CURRENT FreeBSD 10.0-CURRENT #3: Mon Oct 22 10:30:54 PDT 2012     root@fallout-atf-current.local:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
emulators/open-vm-tools fails to compile with -Wformat-security / clang; this is part of the default CFLAGS that gets passed along via buildkernel when building PORTS_MODULES.

This thread has a bit more discussion and a patch for the issue: https://sourceforge.net/tracker/?func=detail&aid=3579794&group_id=204462&atid=989708
>How-To-Repeat:
1. Install FreeBSD CURRENT on a VM.
2. Apply the following patch to so building with bmake and the PORTS_MODULES works (this is just a stopgap patch I'm using in my workspace to dogfood bmake):

Index: /store/freebsd/atf-head/usr.bin/Makefile
===================================================================
--- /store/freebsd/atf-head/usr.bin/Makefile    (revision 241967)
+++ /store/freebsd/atf-head/usr.bin/Makefile    (working copy)
@@ -280,10 +280,9 @@
 .if ${MK_MAKE} != "no"
 .if ${MK_BMAKE} != "no"
 SUBDIR+=       bmake
-.else
+.endif
 SUBDIR+=       make
 .endif
-.endif

 .if ${MK_MAN_UTILS} != "no"
 SUBDIR+=       catman
Index: /store/freebsd/atf-head/usr.bin/make/Makefile
===================================================================
--- /store/freebsd/atf-head/usr.bin/make/Makefile       (revision 241967)
+++ /store/freebsd/atf-head/usr.bin/make/Makefile       (working copy)
@@ -4,7 +4,15 @@

 .include <bsd.own.mk>

+.if ${MK_BMAKE} == "no"
 PROG=  make
+LINKS+=        make pmake
+.else
+pmake.1: make.1
+       cp ${.ALLSRC} ${.TARGET}
+MAN=   pmake.1
+PROG=  pmake
+.endif
 CFLAGS+=-I${.CURDIR}
 SRCS=  arch.c buf.c cond.c dir.c for.c hash.c hash_tables.c job.c      \
        lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c  \
Index: /store/freebsd/atf-head/sys/conf/kern.post.mk
===================================================================
--- /store/freebsd/atf-head/sys/conf/kern.post.mk       (revision 241967)
+++ /store/freebsd/atf-head/sys/conf/kern.post.mk       (working copy)
@@ -59,14 +59,22 @@
        PATH=${PATH}:${LOCALBASE}/bin:${LOCALBASE}/sbin \
        SRC_BASE=${SRC_BASE} \
        OSVERSION=${OSRELDATE} \
-       WRKDIRPREFIX=${WRKDIRPREFIX}
+       WRKDIRPREFIX=${WRKDIRPREFIX} \
+       INSTALL=install

+.if defined(.PARSEFILE)
+# Remove bmake-only supported MAKEFLAGS
+PORTSMAKEFLAGS:= ${MAKEFLAGS:tW:S/-N //:C/ -[JT] [^ ]+ / /g}
+PORTSMODULESENV+= MAKEFLAGS="${PORTSMAKEFLAGS}"
+PMAKE= pmake
+.endif
+
 # The WRKDIR needs to be cleaned before building, and trying to change the target
 # with a :C pattern below results in install -> instclean
 all:
 .for __i in ${PORTS_MODULES}
        @${ECHO} "===> Ports module ${__i} (all)"
-       cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B clean all
+       cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${PMAKE} -B clean all
 .endfor

 .for __target in install reinstall clean
@@ -74,7 +82,7 @@
 ports-${__target}:
 .for __i in ${PORTS_MODULES}
        @${ECHO} "===> Ports module ${__i} (${__target})"
-       cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B ${__target:C/install/deinstall reinstall/:C/reinstall/deinstall reinstall/}
+       cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${PMAKE} -B ${__target:C/install/deinstall reinstall/:C/reinstall/deinstall reinstall/}
 .endfor
 .endfor
 .endif

2. cd /usr/src && make buildworld -DWITH_BMAKE && buildkernel PORTS_MODULES=emulators/open-vm-tools CC=clang CXX=clang++ CPP=clang-cpp
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-ports-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Oct 24 22:29:30 UTC 2012 
Responsible-Changed-Why:  
apparently affects both ports and src. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173030 

From: Garrett Cooper <yaneurabeya@gmail.com>
To: bug-followup@FreeBSD.org,
 yaneurabeya@gmail.com
Cc:  
Subject: Re: kern/173030: [atf] [patch] emulators/open-vm-tools: fix clang compile problem with -Wformat-security when built from PORTS_MODULES
Date: Fri, 12 Jul 2013 00:30:08 -0700

 	Please close this PR; it's unnecessary now that ports works with bmake.
 Thanks,
 -Garrett
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Fri Jul 12 11:50:47 UTC 2013 
State-Changed-Why:  
Closed at submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173030 
>Unformatted:
