commit 5f8c0ac72abfa72cc80d2ff24627c3e3f8db963f Author: Nicolas Vigier boklm@torproject.org Date: Sat Apr 25 12:46:22 2020 +0200
Bug 33993: Check type of target, target_prepend, target_append
Exit with an error message if target, target_prepend or target_append defined in input_files is not an array. --- lib/RBM.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/RBM.pm b/lib/RBM.pm index 375648f..7cc9e24 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -811,19 +811,24 @@ sub input_files { if ($input_file->{target} || $input_file->{target_append} || $input_file->{target_prepend}) { $input_file = { %$input_file }; - if (ref $input_file->{target} eq 'ARRAY') { + foreach my $t (qw/target target_append target_prepend/) { + if ($input_file->{$t} && ref $input_file->{$t} ne 'ARRAY') { + exit_error("$t should be an ARRAY:\n" . pp($input_file)); + } + } + if ($input_file->{target}) { $input_file->{target} = process_template_opt($project, $input_file->{target}, $options); } else { $input_file->{target} = $config->{run}{target}; } - if (ref $input_file->{target_prepend} eq 'ARRAY') { + if ($input_file->{target_prepend}) { $input_file->{target} = [ @{ process_template_opt($project, $input_file->{target_prepend}, $options) }, @{$input_file->{target}} ]; } - if (ref $input_file->{target_append} eq 'ARRAY') { + if ($input_file->{target_append}) { $input_file->{target} = [ @{$input_file->{target}}, @{ process_template_opt($project, $input_file->{target_append},
tbb-commits@lists.torproject.org