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

Minor problem with multiple targets and 'restat' #643

Open
maximuska opened this issue Aug 27, 2013 · 3 comments
Open

Minor problem with multiple targets and 'restat' #643

maximuska opened this issue Aug 27, 2013 · 3 comments

Comments

@maximuska
Copy link
Contributor

Minor problem with multiple targets and 'restat' (anyone uses that?) which I've noticed while working on #608.

rule true
  command = [ -e auto.h ] || touch auto.h  # Simulate 'restat'
  restat = 1 
rule cat 
  command = touch $out
build auto.h auto.c: true
build out: cat auto.c | auto.h

There is a bug in the 'true' command above, it generates only one of the outputs and returns '0'.
On the first build:

ubuntu: ninja> ./ninja -d explain -v -f tst2.ninja 
ninja explain: command line not found in log for auto.h
ninja explain: auto.c is dirty
ninja explain: auto.h is dirty
[1/2] [ -e auto.h ] || touch auto.h  # Simulate 'restat'
ninja explain: command line not found in log for out
[2/2] touch out

that's ok.

On the 2nd:

ubuntu: ninja> ./ninja -d explain -v -f tst2.ninja 
ninja explain: output auto.c doesn't exist
ninja explain: auto.c is dirty
ninja explain: auto.h is dirty
[1/2] [ -e auto.h ] || touch auto.h  # Simulate 'restat'

That I would expect is that 'out' would be rebuilt also (as auto.c doesn't exist and restat was not supposed to clean 'out'), but it is not.

ubuntu: ninja> tail -n1 .ninja_log
0 2 0 auto.c 97a40aff32c1d21a

I think the problem is that '0' stored as 'restat' value of auto.c is also used as 'file doesn't exists' indicator in 'Node'.

@nico
Copy link
Collaborator

nico commented Aug 27, 2013

Pull request #634 fixes another issue that is caused by mtime_ == 0 meaning "doesn't exist" – maybe it fixes this issue too?

@jonesmz

This comment was marked as abuse.

@jhasse
Copy link
Collaborator

jhasse commented Oct 30, 2020

This still happens. I'm wondering why 'out' should be rebuild? auto.c still doesn't exist.

What do you mean by

restat was not supposed to clean 'out'

? It didn't clean 'out', didn't it?

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

No branches or pull requests

4 participants