From owner-freebsd-current Fri Oct 10 21:36:28 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id VAA00196 for current-outgoing; Fri, 10 Oct 1997 21:36:28 -0700 (PDT) (envelope-from owner-freebsd-current) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id VAA00191 for ; Fri, 10 Oct 1997 21:36:22 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id OAA10035; Sat, 11 Oct 1997 14:35:31 +1000 Date: Sat, 11 Oct 1997 14:35:31 +1000 From: Bruce Evans Message-Id: <199710110435.OAA10035@godzilla.zeta.org.au> To: imp@village.org, jkh@time.cdrom.com Subject: Re: make world failed Cc: ache@nagual.pp.ru, current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> Does anybody know why Make started behaving like this? > >Yeah, it comes from the target which "makes make" during the bootstrap >phase in /usr/src/Makefile. Here's the relevant fragment: > > cd ${.CURDIR}/usr.bin/make && \ > ${IBMAKE} -I${.CURDIR}/share/mk -B ${CLEANDIR} ${OBJDIR} depend && .. > >This unfortunately has problems because (assuming that ${CLEANDIR} = >"cleandir" and ${OBJDIR} = "obj" of course) when make first starts up >it goes looking for an appropriate shadow obj tree so that it can >point the ${.OBJDIR} variable at it. Because there's no obj dir yet, >it sets ${.OBJDIR} = ${.CURDIR} as a fall-back. Now the cleandir and >obj targets are run and the obj dir *does* get created but it's too >late for that invocation of make, which has already made up its mind >about that. When the depend runs, it's with the bad ${.OBJDIR} value. That's not why Make started behaving like this. It is why .depend gets put in ${.CURDIR} if there is no obj directory yet. The source tree is usually writable so this usually doesn't cause any problems. Make started behaving like this because: - in rev.1.145, the relevant fragment was cd ${.CURDIR}/usr.bin/make && \ ${IBMAKE} -I${.CURDIR}/share/mk ${OBJDIR} clean cleandepend depend && .. - someone broke things further in rev.1.146. - in rev.1.146, the relevant fragment was cd ${.CURDIR}/usr.bin/make && \ ${IBMAKE} -I${.CURDIR}/share/mk ${CLEANDIR} ${OBJDIR} depend && .. which is essentially as above, and puts .depend in the wrong place if there is no obj directory for the same reasons. - if there is an obj directory, worse things happen. Make first sets .OBJDIR = ${CANONICALOBJDIR} (the usual obj dir) and cd's to it. Then the cleandir target runs and removes make's current directory. Then the obj target runs and creates another obj directory. When the depend runs, it inherits the zombie obj dir from make and all operations in the directory fail. In particular, mkdep can't create a temporary file. If the obj tree is nfs-mounted, then the first failure occurs early, for rm -f, because nfs returns ESTALE instead of ENOENT for (necessarily) failing lookups in the removed directory, and rm -f doesn't understand ESTALE. Bruce