martine/ninja — Issue #148: ninja stuck bug
Author: qhuo
Created: 2011-12-02 21:26:27+00:00
State: open

I've got encountered a ninja bug, which display the following:

ninja: build stopped: stuck [this is a bug]

I managed to reduce it to the following:

$ cat build.ninja
rule fork
description = forking $in to $out...
command = touch $out

rule cxx
description = compiling $in to $out...
command = cp $in $out

build x.s.cpp x.r.cpp: fork x.cpp
build x.o: cxx x.cpp | x.s.cpp

Let's arrange the file modification times in order.

$ touch x.r.cpp; sleep 1; touch x.cpp; sleep 1; touch x.s.cpp

Now running ninja -n with different targets:

$ ninja -n x.s.cpp
ninja: no work to do.
$ ninja -n x.r.cpp
[1/1] forking x.cpp to x.s.cpp x.r.cpp...
$ ninja -n x.o
ninja: build stopped: stuck [this is a bug].

The build is also stuck even if I do not use the -n option.

You may notice that the build.ninja file is exactly the same as the one in #118. This makes me think they could be the same problem. But the impact of this one is more severe.