From 5334edd2f34bf699c56c8145975da3294f5fcf11 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 11 Mar 2021 17:18:21 -0800 Subject: [PATCH] Check RuleBuilder temporaries for path errors Output files in sandboxed RuleBuilder rules must be under the output directory, but output paths that were marked as temporaries were not error checked. Bug: 182612695 Test: rule_builder_test.go Change-Id: I09616402ef1637c2c455ec7d345a296711582e8f --- android/rule_builder.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/android/rule_builder.go b/android/rule_builder.go index 41d2fa64b..75f1b5d9c 100644 --- a/android/rule_builder.go +++ b/android/rule_builder.go @@ -523,6 +523,12 @@ func (r *RuleBuilder) Build(name string, desc string) { }) } + // Outputs that were marked Temporary will not be checked that they are in the output + // directory by the loop above, check them here. + for path := range r.temporariesSet { + Rel(r.ctx, r.outDir.String(), path.String()) + } + // Add a hash of the list of input files to the manifest so that the textproto file // changes when the list of input files changes and causes the sbox rule that // depends on it to rerun.