summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-11-17 13:01:28 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-11-17 16:05:26 +0100
commitf66db4bb21efeead140a453f91280bb9471f24a9 (patch)
treef033defb8ff57641521409649be3418190391c24 /src
parent04486312bdba9b610edbd71d23b5f4a428e04a40 (diff)
downloadjustbuild-f66db4bb21efeead140a453f91280bb9471f24a9.tar.gz
built-in "install" rule: verify well-formedness of resulting stage
The install target, like any other target, has to have artifacts and runfiles being proper stages, i.e., in such a way that the keys can be interpreted as names in the file system without causing conflicts. This property used to be unchecked, thus allowing users to define mal-formed targets that, when used as inputs to actions, would result in unspecified layout of the action directory. Fix this by adding an appropriate check enforcing well-formedness of the resulting stage.
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/buildtool/build_engine/target_map/built_in_rules.cpp b/src/buildtool/build_engine/target_map/built_in_rules.cpp
index 6bd65a55..70ecf1f2 100644
--- a/src/buildtool/build_engine/target_map/built_in_rules.cpp
+++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp
@@ -666,6 +666,11 @@ void InstallRuleWithDeps(
stage = ExpressionPtr{Expression::map_t{stage, to_stage}};
}
+ auto conflict = BuildMaps::Target::Utils::tree_conflict(stage);
+ if (conflict) {
+ (*logger)(fmt::format("TREE conflict on subtree {}", *conflict), true);
+ return;
+ }
auto const& empty_map = Expression::kEmptyMap;
auto result = std::make_shared<AnalysedTarget const>(
TargetResult{