Complain if an unsupported component is explicitly requested

In all.sh, when an explicit list of components is specified, error out
if one of the components is not known or not supported. Patterns that
happen to match zero components are still effectively ignored.

Fix #2783

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2020-03-28 21:37:59 +01:00
parent a681c59d34
commit b80f0d20ea

View File

@ -444,6 +444,24 @@ pre_parse_command_line () {
COMMAND_LINE_COMPONENTS="$COMMAND_LINE_COMPONENTS *_armcc*"
fi
if [ $all_except -eq 0 ]; then
unsupported=0
for component in $COMMAND_LINE_COMPONENTS; do
case $component in
*[*?\[]*) continue;;
esac
case " $SUPPORTED_COMPONENTS " in
*" $component "*) :;;
*)
echo >&2 "Component $component was explicitly requested, but is not known or not supported."
unsupported=$((unsupported + 1));;
esac
done
if [ $unsupported -ne 0 ]; then
exit 2
fi
fi
# Build the list of components to run.
RUN_COMPONENTS=
for component in $SUPPORTED_COMPONENTS; do