From owner-freebsd-current@FreeBSD.ORG  Thu Jul 24 13:33:09 2003
Return-Path: <owner-freebsd-current@FreeBSD.ORG>
Delivered-To: freebsd-current@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 17BA937B401
	for <current@FreeBSD.org>; Thu, 24 Jul 2003 13:33:09 -0700 (PDT)
Received: from smtp3.server.rpi.edu (smtp3.server.rpi.edu [128.113.2.3])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3EBE843F75
	for <current@FreeBSD.org>; Thu, 24 Jul 2003 13:33:08 -0700 (PDT)
	(envelope-from drosih@rpi.edu)
Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47])
	by smtp3.server.rpi.edu (8.12.9/8.12.9) with ESMTP id h6OKX3kM020604;
	Thu, 24 Jul 2003 16:33:04 -0400
Mime-Version: 1.0
X-Sender: drosih@mail.rpi.edu
Message-Id: <p0521068ebb45e857a454@[128.113.24.47]>
In-Reply-To: <3F202FB7.8010609@acm.org>
References: <20030716181354.GA44980@dan.emsphone.com>
 <20030717074756.B17029@gamplex.bde.org>
 <20030717123524.T24327@schnell.net>
 <20030718154832.K21942@gamplex.bde.org>
 <20030718095946.H29869@schnell.net> <3F183EF9.7020506@acm.org>
 <20030721084750.GH12996@roark.gnf.org> <3F1C1695.30409@acm.org>
 <p05210687bb44ba2cd1d7@[128.113.24.47]>
 <p05210688bb44c9d17c89@[128.113.24.47]>
 <20030723234415.GE12996@roark.gnf.org>
 <p0521068abb44d439ecfa@[128.113.24.47]> <3F202FB7.8010609@acm.org>
Date: Thu, 24 Jul 2003 16:33:02 -0400
To: kientzle@acm.org
From: Garance A Drosihn <drosih@rpi.edu>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-Scanned-By: CanIt (www . canit . ca)
cc: current@FreeBSD.org
Subject: Re: Buildworld /rescue failures in 5.1
X-BeenThere: freebsd-current@freebsd.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: Discussions about the use of FreeBSD-current
	<freebsd-current.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-current>
List-Post: <mailto:freebsd-current@freebsd.org>
List-Help: <mailto:freebsd-current-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-current>,
	<mailto:freebsd-current-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 24 Jul 2003 20:33:09 -0000

At 12:12 PM -0700 7/24/03, Tim Kientzle wrote:
>Garance A Drosihn wrote:
>>So indeed, that 'make depend' had not finished before the
>>'make' for the object had started.
>
>There's another possibility here:  suppose two copies
>of make are running simultaneously and both get to
>this sequence at about the same time:
>
>  tar_make:
>          (cd $(tar_SRCDIR) && \
>                  $(MAKE) $(BUILDOPTS) $(tar_OPTS) depend &&\
>                  $(MAKE) $(BUILDOPTS) $(tar_OPTS) $(tar_OBJS))
>
>
>The first make to run this will start building dependencies.
>The second copy will see that ".depend" already exists (note
>that bsd.dep.mk builds .depend incrementally) and then go on
>to the next step.

I am still not exactly sure what is going on here, but it
looks like Gordon has committed a change which has solved
the problem which I kept running into.  It's a little
tricky to figure out exactly what is going on, since the
problem so dependent upon the exact timing of the events.

However, I would note that in at least some of my testing,
the .depend file did *not* exist -- not at all -- in the
directory that it needed to be in.

Still, it does sound like a good idea to make the creation
of .depend to be an atomic operation.  I might prefer to use
the 'mktemp' command, instead of adding a PID.  Something
along the lines of:
DEPENDTMP=`mktemp ${DEPENDFILE}.XXXXX`

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu