@@ -27,8 +27,6 @@ distclean: distclean-keys
shellcheck:
shellcheck \
- -i SC2086,SC2181,SC2046,SC2320,SC2317,SC2034,SC2164,SC2166 \
- -i SC2294,SC2206,SC2196,SC2043,SC2295 \
functions.sh gen-keys.sh install-fsverity.sh \
install-mount-idmapped.sh install-openssl3.sh \
install-swtpm.sh install-tss.sh softhsm_setup \
@@ -1090,7 +1090,7 @@ if [ $((evm_value & EVM_INIT_X509)) -ne "$EVM_INIT_X509" ] && [ "$TST_EVM_CHANGE
echo "$EVM_INIT_X509" > /sys/kernel/security/evm 2> /dev/null
fi
-if [ "$(expr index "$TST_LIST" "check_evm_revalidate")" -gt 0 ] && [ "$TST_EVM_CHANGE_MODE" -eq 1 ]; then
+if echo "$TST_LIST" | grep -q -w check_evm_revalidate && [ "$TST_EVM_CHANGE_MODE" -eq 1 ]; then
echo "$EVM_ALLOW_METADATA_WRITES" > /sys/kernel/security/evm 2> /dev/null
fi
Address issues detected by shellcheck SC2003: expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]. The following statement in portable_signatures.test causes the issue: expr index "$TST_LIST" "check_evm_revalidate" The man page for expr states: index STRING CHARS index in STRING where any CHARS is found, or 0 The intention is certainly not to find an index of any of the characters in "check_evm_revalidate" in $TST_LIST but to find the word "check_evm_revalidate" in $TST_LIST. Therefore, use grep -w to determine whether the word is there. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Cc: Roberto Sassu <roberto.sassu@huawei.com> --- tests/Makefile.am | 2 -- tests/portable_signatures.test | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)