Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Sep 2002 11:46:32 +1000 (EST)
From:      Edwin Groothuis <edwin@mavetju.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/43273: [patch] make bsd.port.mk checksum check aware of multiple people fetching/compiling 
Message-ID:  <20020923014632.0C1706A7124@k7.mavetju>

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

>Number:         43273
>Category:       ports
>Synopsis:       [patch] make bsd.port.mk checksum check aware of multiple people fetching/compiling
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 22 18:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Edwin Groothuis
>Release:        FreeBSD 4.5-RELEASE i386
>Organization:
-
>Environment:
System: FreeBSD k7.mavetju 4.5-RELEASE FreeBSD 4.5-RELEASE #4: Sat Sep 14 10:41:50 EST 2002 edwin@k7.mavetju:/usr/src/sys/compile/k7 i386

$FreeBSD: ports/Mk/bsd.port.mk,v 1.424 2002/09/19 00:16:39 kris Exp $

>Description:

Sometimes, two people are running make at the same time for a
related port, for example Alice is running make for port A which
depends on port C and Bob is running make for port B which depend
on port C too.

So Alice is downloading the tarball for port C and Bob runs make for
port B. Bobs make will see that port C isn't installed, but it finds
a file in /usr/ports/distfiles and will do the checksum match. It
fails, because the tarball is still incomplete. Bob removed the
tarball from /usr/ports/distfiles and tries again. Now it downloads.
In the mean time, Alice has completed her download and her make
finds that the tarball (which is now being downloaded bij Bob) has
the wrong checksum (because it's still being downloaded). Ad
infinitum until one gives up and gets a cup of coffee, in the mean
time the other will complete the download, install port C and install
his/her port B or A.

>How-To-Repeat:

See description

>Fix:

This patch will check if the file for which the checksum fails is
being opened in write-mode for somebody else, giving it a different
message:

--- bsd.port.mk.old	Mon Sep 23 11:26:02 2002
+++ bsd.port.mk	Mon Sep 23 11:33:51 2002
@@ -2882,8 +2882,11 @@
 				OK="false"; \
 			elif ${EXPR} "$$CKSUM2" : ".*$$CKSUM" > /dev/null; then \
 				${ECHO_MSG} ">> Checksum OK for $$file."; \
-			else \
+			elif [ ! -z "`/usr/bin/fstat $$file | ${AWK} '{ print $9 }' | ${GREP} w`" ]; then \
+				${ECHO_MSG} ">> Checksum mismatch for $$file, somebody is writing to it right now."; \
+				OK="false"; \
+			else \
 				${ECHO_MSG} ">> Checksum mismatch for $$file."; \
 				OK="false"; \
 			fi; \
 		  done; \

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

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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