automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

race condition gnulib-tool's mostlyclean-local rule


From: Jim Meyering
Subject: race condition gnulib-tool's mostlyclean-local rule
Date: Fri, 04 Aug 2006 16:35:30 +0200

For some modules (e.g., sys_stat), gnulib-tool generates
a mostlyclean-local rule like this:

mostlyclean-local:
        @test -z "$(MOSTLYCLEANDIRS)" ||        \
          for dir in $(MOSTLYCLEANDIRS); do     \
            if test -d $$dir; then              \
              echo "rmdir $$dir"; rmdir $$dir;  \
            fi;                                 \
        done

It works fine when Make rules are run in sequence.
But I always run make in parallel, e.g., with -j3.
That causes the rmdir to fail if not all MOSTLYCLEANFILES
have been removed when the above rmdir runs.  But if you look
right afterwards, you find that it is indeed empty.
FYI, this triggered a failure in coreutils "make distcheck"
with some changes I'm working on.

One way to fix it is by changing automake to generate
a slightly different rule.  Currently it emits this:

mostlyclean-am: mostlyclean-compile mostlyclean-generic \
                mostlyclean-local

The problem would be solved if automake were to emit this instead:

mostlyclean-am: mostlyclean-compile mostlyclean-generic
        $(MAKE) mostlyclean-local

While I wait for an official automake fix, I'm using the more
aggressive -- i.e., slightly risky -- rule in my Makefile.am:

mostlyclean-local:
        @test -z "$(MOSTLYCLEANDIRS)" || rm -rf $(MOSTLYCLEANDIRS)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]