Skip to content

1.13.0 regression: no more "multiple rules generate" error with dyndep #2621

@dseomn

Description

@dseomn

In the build file below, there are two rules that generate the same file, but ninja can't know that until after it reads the dyndep files. In 1.12.1, it detected the error and returned 1. In 1.13.0, it looks like it's building the dd-* files more times than it should, and then it's not catching the duplicate output error.

rule dd
  command = printf 'ninja_dyndep_version = 1\nbuild stamp-$n | out: dyndep\n' > $out
rule touch
  command = touch stamp-$n out
  dyndep = dd-$n
build dd-1: dd
  n = 1
build dd-2: dd
  n = 2
build stamp-1: touch || dd-1
  n = 1
build stamp-2: touch || dd-2
  n = 2
$ rm -f .ninja_log dd-1 dd-2 stamp-1 stamp-2 out && ~/ninja-1.12.1 -d explain; echo $?
ninja explain: output dd-1 doesn't exist
ninja explain: output stamp-1 doesn't exist
ninja explain: output dd-2 doesn't exist
ninja explain: output stamp-2 doesn't exist
[1/4] printf 'ninja_dyndep_version = 1\nbuild stamp-1 | out: dyndep\n' > dd-1
ninja explain: loading dyndep file 'dd-1'
ninja explain: output stamp-1 doesn't exist
[2/4] printf 'ninja_dyndep_version = 1\nbuild stamp-2 | out: dyndep\n' > dd-2
ninja explain: loading dyndep file 'dd-2'
ninja: build stopped: multiple rules generate out.
1
$ rm -f .ninja_log dd-1 dd-2 stamp-1 stamp-2 out && ~/ninja-1.13.0 -d explain; echo $?
ninja explain: output dd-1 doesn't exist
[0/4] printf 'ninja_dyndep_version = 1\nbuild stamp-1 | out: dyndep\n' > dd-1
ninja explain: output dd-2 doesn't exist
[0/4] printf 'ninja_dyndep_version = 1\nbuild stamp-2 | out: dyndep\n' > dd-2
ninja explain: output dd-1 doesn't exist
[1/4] printf 'ninja_dyndep_version = 1\nbuild stamp-1 | out: dyndep\n' > dd-1
ninja explain: output stamp-1 doesn't exist
ninja explain: output stamp-1 doesn't exist
[1/4] touch stamp-1 out
ninja explain: output dd-2 doesn't exist
[2/4] printf 'ninja_dyndep_version = 1\nbuild stamp-2 | out: dyndep\n' > dd-2
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions