public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
* [ima-evm-utils: PATCH] shellcheck: Fix shellcheck v0.11.0 issues detected in fsverity.test
@ 2026-03-24 21:26 Stefan Berger
  0 siblings, 0 replies; only message in thread
From: Stefan Berger @ 2026-03-24 21:26 UTC (permalink / raw)
  To: linux-integrity; +Cc: zohar, roberto.sassu, Stefan Berger

Fix the following issue detected by shellcheck:

if [ "x$(id -u)" != "x0" ]; then
     ^---------^ SC2268 (style): Avoid x-prefix in comparisons as it no \
    longer serves a purpose.

Also fix several of the following types of issues by disabling the
shellcheck error. Shellcheck does not recognize the invocation of functions
when they are indirectly invoked when they are passed as parameter to
another function.

__skip() { return "$SKIP"; }
^-- SC2329 (info): This function is never invoked. Check usage (or \
    ignored if invoked indirectly).

Also see: https://www.shellcheck.net/wiki/SC2329

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 tests/kernel/fsverity.test | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/kernel/fsverity.test b/tests/kernel/fsverity.test
index 734d490..9c0f381 100755
--- a/tests/kernel/fsverity.test
+++ b/tests/kernel/fsverity.test
@@ -52,6 +52,7 @@ _require dd mkfs blkid e2fsck tune2fs evmctl setfattr
 
 trap '_report_exit_and_cleanup _cleanup_env cleanup' SIGINT SIGTERM EXIT
 
+# shellcheck disable=SC2329
 cleanup() {
         if [ -e "$TST_MNT" ]; then
 		if [ "$LOOPBACK_MOUNTED" -eq 1 ]; then
@@ -220,6 +221,7 @@ load_policy_rule() {
 	return 0
 }
 
+# shellcheck disable=SC2329
 create_file() {
 	local test=$1
 	local type=$2
@@ -236,6 +238,7 @@ create_file() {
 	chmod a+x "$TST_FILE"
 }
 
+# shellcheck disable=SC2329
 measure-verity() {
 	local test=$1
 	local verity="${2:-disabled}"
@@ -297,6 +300,7 @@ measure-verity() {
 	return "$error"
 }
 
+# shellcheck disable=SC2329
 measure-ima() {
 	local test=$1
 	local digest_filename
@@ -375,7 +379,7 @@ if ! evmctl --help | grep -q veritysig ; then
 	exit "$SKIP"
 fi
 
-if [ "x$(id -u)" != "x0" ]; then
+if [ "$(id -u)" != "0" ]; then
 	echo "${CYAN}SKIP: Must be root to execute this test${NORM}"
 	exit "$SKIP"
 fi
@@ -403,6 +407,7 @@ create_loopback_file ext4
 
 # Commit 989dc72511f7 ("ima: define a new template field named 'd-ngv2' and
 # templates") introduced ima-ngv2 and ima-sigv2 in linux-5.19.
+# shellcheck disable=SC2329
 __skip() { return "$SKIP"; }
 
 # IMA policy rule using the ima-ngv2 template
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-03-24 21:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 21:26 [ima-evm-utils: PATCH] shellcheck: Fix shellcheck v0.11.0 issues detected in fsverity.test Stefan Berger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox