ports/164351: [patch] fix simple race condition in making work directory

Garrett Cooper yanegomi at gmail.com
Sat Jan 21 10:40:09 UTC 2012


>Number:         164351
>Category:       ports
>Synopsis:       [patch] fix simple race condition in making work directory
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 21 10:40:09 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9.0-STABLE
>Organization:
iXsystems, Inc.
>Environment:
FreeBSD bayonetta.local 9.0-STABLE FreeBSD 9.0-STABLE #4 r230371M: Thu Jan 19 23:55:38 PST 2012     gcooper at bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64

>Description:
make -j with -j > 1 doesn't work out of the box today because of inherent race conditions in terms of how the licensing framework works today. Instead of properly defining the WRKDIR target in bsd.ports.mk, it was being defined inline in the package-noinstall target and implicitly being depended upon in the ${_LICENSE_COOKIE} target under bsd.licenses.mk .
>How-To-Repeat:
cd /usr/ports/devel/gettext; make -j10 all
>Fix:


Patch attached with submission follows:

diff --git a/bsd.licenses.mk b/bsd.licenses.mk
index 0247df7..836cef8 100644
--- a/bsd.licenses.mk
+++ b/bsd.licenses.mk
@@ -574,7 +574,7 @@ check-license:
 
 ask-license: ${_LICENSE_COOKIE}
 
-${_LICENSE_COOKIE}:
+${_LICENSE_COOKIE}: ${_LICENSE_COOKIE:H}
 # Make sure all required license files exist
 .if ${_LICENSE_COMB} == "single"
 .	if !defined(LICENSE_FILE) && defined(_LICENSE_TEXT)
diff --git a/bsd.port.mk b/bsd.port.mk
index 1a29521..481292d 100644
--- a/bsd.port.mk
+++ b/bsd.port.mk
@@ -1552,6 +1552,9 @@ WRKSRC?=		${WRKDIR}
 WRKSRC?=		${WRKDIR}/${DISTNAME}
 .endif
 
+${WRKDIR} ${WRKSRC}:
+	@${MKDIR} ${.TARGET}
+
 PATCH_WRKSRC?=	${WRKSRC}
 CONFIGURE_WRKSRC?=	${WRKSRC}
 BUILD_WRKSRC?=	${WRKSRC}
@@ -4942,8 +4945,7 @@ pre-repackage:
 # install package cookie
 
 .if !target(package-noinstall)
-package-noinstall:
-	@${MKDIR} ${WRKDIR}
+package-noinstall: ${WRKDIR}
 	@cd ${.CURDIR} && ${MAKE} pre-package \
 		pre-package-script do-package post-package-script
 	@${RM} -f ${TMPPLIST}


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



More information about the freebsd-ports-bugs mailing list