summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2023-04-17 09:44:44 (GMT)
committerDavid 'Digit' Turner <digit+github@google.com>2023-04-27 16:33:59 (GMT)
commit5f8a1fcd3335b45c1452e88b8ab87458757d212c (patch)
treea41fc5725ff1a91b414138e31657ddbb6411bf37 /misc
parentadf9bddd73869084a505fac83246e55c35880079 (diff)
downloadNinja-5f8a1fcd3335b45c1452e88b8ab87458757d212c.zip
Ninja-5f8a1fcd3335b45c1452e88b8ab87458757d212c.tar.gz
Ninja-5f8a1fcd3335b45c1452e88b8ab87458757d212c.tar.bz2
Allow duplicate rule variable usage.
This fixes #1966 by removing the variable name from the lookups stack once the recursive lookup call has been performed. Without this, any previously expanded variable could no longer be referenced in the command, as Ninja would (incorrectly) complain about a cyclical dependency.
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/output_test.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/misc/output_test.py b/misc/output_test.py
index 141716c..94d1fda 100755
--- a/misc/output_test.py
+++ b/misc/output_test.py
@@ -112,6 +112,19 @@ red
\x1b[31mred\x1b[0m
''')
+ def test_issue_1966(self):
+ self.assertEqual(run(
+'''rule cat
+ command = cat $rspfile $rspfile > $out
+ rspfile = cat.rsp
+ rspfile_content = a b c
+
+build a: cat
+''', '-j3'),
+'''[1/1] cat cat.rsp cat.rsp > a\x1b[K
+''')
+
+
def test_pr_1685(self):
# Running those tools without .ninja_deps and .ninja_log shouldn't fail.
self.assertEqual(run('', flags='-t recompact'), '')