Subject: bug#11854: make syntax-check -j issue

From: Jim Meyering <[email-masked]>
Date: Thu, 05 Jul 2012 09:38:33 +0200

Bernhard Voelker wrote:
> After pulling to the lastest revision (v8.17-37-g74427c7) and
> a successful build (make -j), a subsequent "make syntax-check -j"
> failed:
>
>   ...
>   8.47 vulnerable_makefile_CVE-2009-4029
>   8.78 copyright_check
>     CC     hostname.o
>     CCLD   arch
>     CCLD   arch
>     CC     hostname.o
>     CC     hostname.o
>     CCLD   arch
>   13.02 tight_scope
>   15.36 THANKS_in_duplicates
>   15.91 po_check
>   mv: cannot move `.deps/hostname.Tpo' to `.deps/hostname.Po': No such file or directory
>   make[1]: *** [hostname.o] Error 1
>   make: *** [sc_check-AUTHORS] Error 2
>   make: *** Waiting for unfinished jobs....
>   mv: cannot stat `.deps/hostname.Tpo': No such file or directory
>     CCLD   hostname
>   make[1]: *** [hostname.o] Error 1
>   make: *** [sc_man_file_correlation] Error 2
>
> Another "make syntax-check -j" succeeded, i.e. there's some dependency
> which is not taken care of for parallel syntax-check'ing.
>
> I don't know CU's config scripts enough to know where to look at.
> Any idea?

Yes, this is annoying.  I hit it pretty regularly, but haven't delved
into it enough to fix it.  The problem is that two rules are running
simultaneously to create arch and hostname, and that leads to a race in
automake's dependency-generating code.

One solution would be to make automake include $$ in that temporary
file name, e.g., .deps/hostname-$$.Tpo.  Then, it wouldn't matter if
two processes were to run that rule at the same time.

The problem arises only with arch and hostname because of their
special status (built but not installed), so another possible fix
is probably to adjust dependencies to ensure they're built before
running the offending rules.

A more aggressive solution would be to stop building those two
programs by default.