Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Oct 1997 14:35:31 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        imp@village.org, jkh@time.cdrom.com
Cc:        ache@nagual.pp.ru, current@FreeBSD.ORG
Subject:   Re: make world failed
Message-ID:  <199710110435.OAA10035@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> 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



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