Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jan 2012 05:19:23 GMT
From:      Garrett Cooper <yanegomi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/163908: [patch] filesystem based race condition in multimedia/xvid
Message-ID:  <201201080519.q085JNN4027803@red.freebsd.org>
Resent-Message-ID: <201201080520.q085K6JV026161@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         163908
>Category:       ports
>Synopsis:       [patch] filesystem based race condition in multimedia/xvid
>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:   Sun Jan 08 05:20:05 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9.0-RELEASE
>Organization:
n/a
>Environment:
FreeBSD bayonetta.local 9.0-STABLE FreeBSD 9.0-STABLE #1 r229323M: Mon Jan  2 14:32:54 PST 2012     gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
>Description:
Compilation failures occur regularly on build.ixsystems.com (but I've also seen it occur on streetfighter.ixsystems.com) because a directory was created via install -d, but it already exists and thus install fails.

The best solution to this problem would be to create rules that mkdir // install the directories, s.t. gmake could resolve the dependencies, create the directories beforehand, and the race would be resolved (I've done it before with LTP), but it's trickier with xvid because it uses some whacky pattern rules and I'm short on time right now (I might submit a proper patch upstream after I submit the bug report).

The attached patch just changes $(INSTALL) to mkdir -m 0755 -p as a simple hack, because mkdir -p doesn't fail if the target directory already exists.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- Makefile	2012-01-07 20:28:54.382985196 -0800
+++ Makefile	2012-01-07 20:31:19.373992363 -0800
@@ -85,7 +85,7 @@
 
 $(BUILD_DIR):
 	@echo "  D: $(BUILD_DIR)"
-	@$(INSTALL) -d $(BUILD_DIR)
+	@mkdir -m 0755 -p $(BUILD_DIR)
 
 #-----------------------------------------------------------------------------
 # Generic assembly rule
@@ -93,7 +93,7 @@
 
 .$(ASSEMBLY_EXTENSION).$(OBJECT_EXTENSION):
 	@echo "  A: $(@D)/$(<F)"
-	@$(INSTALL) -d $(BUILD_DIR)/$(@D)
+	@mkdir -m 0755 -p $(BUILD_DIR)/$(@D)
 	@$(AS) $(AFLAGS) $< -o $(BUILD_DIR)/$@
 
 #-----------------------------------------------------------------------------
@@ -104,7 +104,7 @@
 
 .c.$(OBJECT_EXTENSION):
 	@echo "  C: $(@D)/$(<F)"
-	@$(INSTALL) -d $(BUILD_DIR)/$(@D)
+	@mkdir -m 0755 -p $(BUILD_DIR)/$(@D)
 	@$(CC) -c $(ARCHITECTURE) $(BUS) $(ENDIANNESS) $(FEATURES) $(SPECIFIC_CFLAGS) $(CFLAGS) $< -o $(BUILD_DIR)/$@
 
 #-----------------------------------------------------------------------------
@@ -142,13 +142,13 @@
 
 install: $(BUILD_DIR)/$(STATIC_LIB) $(BUILD_DIR)/$(SHARED_LIB)
 	@echo "  D: $(libdir)"
-	@$(INSTALL) -d $(DESTDIR)$(libdir)
+	@mkdir -m 0755 -p $(DESTDIR)$(libdir)
 	@echo "  I: $(libdir)/$(SHARED_LIB)"
 	@$(INSTALL) -m 644 $(BUILD_DIR)/$(SHARED_LIB) $(DESTDIR)$(libdir)/$(SHARED_LIB)
 	@echo "  I: $(libdir)/$(STATIC_LIB)"
 	@$(INSTALL) -m 644 $(BUILD_DIR)/$(STATIC_LIB) $(DESTDIR)$(libdir)/$(STATIC_LIB)
 	@echo "  D: $(includedir)"
-	@$(INSTALL) -d $(DESTDIR)$(includedir)
+	@mkdir -m 0755 -p -d $(DESTDIR)$(includedir)
 	@echo "  I: $(includedir)/xvid.h"
 	@$(INSTALL) -m 644 $(SRC_DIR)/xvid.h $(DESTDIR)$(includedir)/xvid.h
 


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201080519.q085JNN4027803>