From nobody@FreeBSD.org  Tue Apr 23 02:59:32 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id CC9AA11B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 23 Apr 2013 02:59:32 +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 BE80213CB
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 23 Apr 2013 02:59:32 +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 r3N2xWv4053553
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 23 Apr 2013 02:59:32 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r3N2xWp4053552;
	Tue, 23 Apr 2013 02:59:32 GMT
	(envelope-from nobody)
Message-Id: <201304230259.r3N2xWp4053552@red.freebsd.org>
Date: Tue, 23 Apr 2013 02:59:32 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] _worldtmp can fail sometimes if WORLDTMP/LIB32TMP is chflag'ed
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         178065
>Category:       conf
>Synopsis:       [build] [patch] _worldtmp can fail sometimes if WORLDTMP/LIB32TMP is chflag'ed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 23 03:00:01 UTC 2013
>Closed-Date:    
>Last-Modified:  Sun May 04 03:43:36 UTC 2014
>Originator:     Garrett Cooper
>Release:        10-CURRENT
>Organization:
EMC Isilon
>Environment:
FreeBSD gran-tourismo.west.isilon.com 10.0-CURRENT FreeBSD 10.0-CURRENT #2 r+ba9afe9: Fri Apr 19 20:29:10 PDT 2013     gcooper@gran-tourismo.west.isilon.com:/usr/obj/usr/src/sys/GRAN-TOURISMO  amd64
>Description:
In the event that make libraries fails and ${MAKEOBJDIRPREFIX} != /usr/obj and NO_CLEAN is not set, the build can fail to nuke ${WORLDTMP} and/or ${LIB32TMP} nigh immediately. This patch addresses those issues by following the same pattern that cleanworld employs in .../Makefile .
>How-To-Repeat:
See above comments.
>Fix:


Patch attached with submission follows:

From 6c2f1c4cb7aa053910c70b8b49c9a1643a309ef4 Mon Sep 17 00:00:00 2001
From: Garrett Cooper <yanegomi@gmail.com>
Date: Mon, 22 Apr 2013 17:15:51 -0700
Subject: [PATCH 1/3] Nuke chflags on LIB32TMP and WORLDTMP

Sometimes these directories can be chflag'ed noschg, which means that
the rm -rf will fail immediately; just unchflag the entire directory
like cleanworld does today.

Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
---
 Makefile.inc1 | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 4ce189c..27e0d1b 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -422,10 +422,18 @@ _worldtmp:
 	@echo ">>> Rebuilding the temporary build tree"
 	@echo "--------------------------------------------------------------"
 .if !defined(NO_CLEAN)
+.if exists(${WORLDTMP}/)
+	-rm -rf ${WORLDTMP}
+	-chflags -R 0 ${WORLDTMP}
 	rm -rf ${WORLDTMP}
+.endif
 .if defined(LIB32TMP)
+.if exists(${LIB32TMP}/)
+	-rm -rf ${LIB32TMP}
+	-chflags -R 0 ${LIB32TMP}
 	rm -rf ${LIB32TMP}
 .endif
+.endif
 .else
 	rm -rf ${WORLDTMP}/legacy/usr/include
 #	XXX - These three can depend on any header file.
-- 
1.8.2



>Release-Note:
>Audit-Trail:
>Unformatted:
