Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restat needlessly rebuilding outputs #1940

Open
dmoody256 opened this issue Mar 26, 2021 · 2 comments · May be fixed by #1941
Open

restat needlessly rebuilding outputs #1940

dmoody256 opened this issue Mar 26, 2021 · 2 comments · May be fixed by #1941

Comments

@dmoody256
Copy link

Using this ninja file:

rule INSTALL
    command = rm -f $out; ln $in $out
    restat = 1
build install/output1.txt: INSTALL src/input1.txt
build install/output2.txt: INSTALL install/output1.txt | install/output3.txt
build install/output3.txt: INSTALL src/input2.txt

And creating fake inputs in this order:

mkdir src
touch src/input1.txt
touch src/input2.txt

Ninja will rebuild files that have already been built on consecutive runs when nothing has changed:

> ninja --version
1.10.0.git.kitware.jobserver-1
> ninja -d explain | cat
ninja explain: output install/output1.txt doesn't exist
ninja explain: install/output1.txt is dirty
ninja explain: output install/output3.txt doesn't exist
ninja explain: install/output3.txt is dirty
[1/3] rm -f install/output1.txt; ln src/input1.txt install/output1.txt
[2/3] rm -f install/output3.txt; ln src/input2.txt install/output3.txt
[3/3] rm -f install/output2.txt; ln install/output1.txt install/output2.txt
> ninja -d explain | cat
ninja explain: restat of output install/output2.txt older than most recent input install/output3.txt (1616728218815774370 vs 1616728221187789429)
[1/1] rm -f install/output2.txt; ln install/output1.txt install/output2.txt
> ninja -d explain | cat
ninja: no work to do.
@dmoody256 dmoody256 changed the title restat needlessly rebuilding files restat needlessly rebuilding outputs Mar 26, 2021
@jdrouhard
Copy link
Contributor

Can you try #1943 and see if that fixes this issue?

@dmoody256
Copy link
Author

Can you try #1943 and see if that fixes this issue?

@jdrouhard I confirmed that branch fixes this issue.

dmoody256 added a commit to dmoody256/ninja that referenced this issue Mar 30, 2021
dmoody256 added a commit to dmoody256/ninja that referenced this issue Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@jdrouhard @dmoody256 and others