'make clean' can go into infinite recursion

RESOLVED WONTFIX

Status

Firefox Build System
General
RESOLVED WONTFIX
7 years ago
4 months ago

People

(Reporter: gerv, Assigned: joey)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

I just did a "make clean" on a comm-central tree, and got the following recurring output (it got up to 7000+ nested make processes before I broke out):

make[707]: Entering directory `/usr/src/obj-i686-pc-linux-gnu-thunderbird/mozilla/config'
rm -f .md  .bak core     Templates.DB ../dist/stl_wrappers/sentinel ../config/final-link-comps ../config/final-link-libs ../config/final-link-comp-names buildid /usr/src/comm-central/mozilla/config/*.pyc *.pyc nsinstall  elf-dynstr-gc   LOGS TAGS a.out     host_nsinstall.o host_pathsub.o host_nsinstall.o host_pathsub.o    so_locations _gen _stubs               
rm -f -r .deps _java system_wrappers stl_wrappers /no-such-file
cd /usr/src/obj-i686-pc-linux-gnu-thunderbird/mozilla/config/mkdepend; make clean
cd: 1: can't cd to /usr/src/obj-i686-pc-linux-gnu-thunderbird/mozilla/config/mkdepend
make[708]: Entering directory `/usr/src/obj-i686-pc-linux-gnu-thunderbird/mozilla/config'
rm -f .md  .bak core     Templates.DB ../dist/stl_wrappers/sentinel ../config/final-link-comps ../config/final-link-libs ../config/final-link-comp-names buildid /usr/src/comm-central/mozilla/config/*.pyc *.pyc nsinstall  elf-dynstr-gc   LOGS TAGS a.out     host_nsinstall.o host_pathsub.o host_nsinstall.o host_pathsub.o    so_locations _gen _stubs               
rm -f -r .deps _java system_wrappers stl_wrappers /no-such-file
cd /usr/src/obj-i686-pc-linux-gnu-thunderbird/mozilla/config/mkdepend; make clean
cd: 1: can't cd to /usr/src/obj-i686-pc-linux-gnu-thunderbird/mozilla/config/mkdepend
make[709]: Entering directory `/usr/src/obj-i686-pc-linux-gnu-thunderbird/mozilla/config'
...
(and so on for 7000 instances)

I don't know why it couldn't cd to the directory /usr/src/obj-i686-pc-linux-gnu-thunderbird/mozilla/config/mkdepend. And I'm afraid I nuked my objdir and rebuilt, so I can't look. I assume the dir wasn't there, but I can't be certain. Still, perhaps this bug report is useful. Shouldn't we be checking the "cd" succeeds?

Gerv

Comment 1

7 years ago
mozilla/config/Makefile.in is actually a core makefile, so changing component.
Component: Build Config → Build Config
Product: Thunderbird → Core
QA Contact: build-config → build-config

Comment 2

6 years ago
I got a similar error when trying to build trunk firefox with "mk_add_options MOZ_PGO=1".

With pgo off, firefox builds fine except not pgo obviously.

With pgo on, I get the error.  Started about a week ago as far as I remember, I just assumed pgo broke again and turned it off and rebuilt.
(Assignee)

Comment 3

6 years ago
Partially clean { or failed while building } sandboxes are prone to the problem.
An existence check prior to make clean may help prevent the problem.

If built, remove ${obj}/config/mkdepend before "make clean" and make will begin looping.


#!/bin/bash

obj=obj-x86_64-unknown-linux-gnu

gmake -C ${obj}/config COMPILER_DEPEND=
/bin/ls -ld obj-x86_64-unknown-linux-gnu/config/mkdepend
/bin/rm -fr ${obj}/config/mkdepend

gmake -f client.mk clean


cd /local/mozilla/bugs/mc/obj-x86_64-unknown-linux-gnu/config/mkdepend; gmake clean
cd: 1: can't cd to /local/mozilla/bugs/mc/obj-x86_64-unknown-linux-gnu/config/mkdepend
gmake[3]: Entering directory `/local/mozilla/bugs/mc/obj-x86_64-unknown-linux-gnu/config'
rm -f .md  .bak core     Templates.DB ../dist/stl_wrappers/sentinel ../config/final-link-comps ../config/final-link-libs ../config/final-link-comp-names buildid /local/mozilla/bugs/mc/config/*.pyc *.pyc nsinstall    LOGS TAGS a.out     host_nsinstall.o host_pathsub.o host_nsinstall.o host_pathsub.o    so_locations _gen _stubs               
rm -f -r _java system_wrappers stl_wrappers /no-such-file
(Assignee)

Comment 4

6 years ago
Created attachment 615811 [details] [diff] [review]
Attempt make clean on MKDEPEND_DIR only when it exists

Rewrote make clean line for MKDEPEND_DIR to only attempt recursive clean when the directory exists.  Otherwise short-circuit the call, succeed and keep going.
Assignee: nobody → joey
Attachment #615811 - Flags: review?(ted.mielczarek)
This was happening 100% of the time to me on linux with 'make clean', breaking PGO builds among other things. It seems to happen even on fully-built builds. `mkdepend` is never built/used (I couldn't quite follow the logic through the makefiles, but I believe it's defaulting to compiler-dependency generation). However, MKDEPEND_DIR is set, so it tries to clean it.

A quick hack to avoid having an extra patch on your tree is to put this in your build script:

> # Work around bug 717947
> (
>   cd "$objdir"
>   for x in {js/src/,}config; do
>     $MAKE -C $x DIRS+=mkdepend mkdepend/Makefile
>   done
> )

Thanks for looking into this Joey
I actually filed a bug on removing all the mkdepend stuff, bug 740854
(Assignee)

Comment 7

6 years ago
(In reply to Ted Mielczarek [:ted] from comment #6)
> I actually filed a bug on removing all the mkdepend stuff, bug 740854

Would it be worth applying the patch to lessen pain threshold in the interim ?  I don't mind either way -- if mkdepend will be going away soon this big can be closed.
(Assignee)

Comment 8

6 years ago
(In reply to John Schoenick [:johns] from comment #5)
> This was happening 100% of the time to me on linux with 'make clean',
> breaking PGO builds among other things. It seems to happen even on
> fully-built builds. `mkdepend` is never built/used (I couldn't quite follow
> the logic through the makefiles, but I believe it's defaulting to
> compiler-dependency generation). However, MKDEPEND_DIR is set, so it tries
> to clean it.
> 
> A quick hack to avoid having an extra patch on your tree is to put this in
> your build script:
> 
> > # Work around bug 717947
> > (
> >   cd "$objdir"
> >   for x in {js/src/,}config; do
> >     $MAKE -C $x DIRS+=mkdepend mkdepend/Makefile
> >   done
> > )
> 
> Thanks for looking into this Joey

Thanks for the local edit John
(Assignee)

Updated

6 years ago
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → WONTFIX
(Assignee)

Updated

6 years ago
Depends on: 740854
This doesn't need to be WONTFIX, it's a real bug. Fixing bug 740854 would be preferable to putting in some specific workaround here. I don't imagine it's a large task, just some cleanup.
Attachment #615811 - Flags: review?(ted.mielczarek)

Updated

4 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.