public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: linux-integrity@vger.kernel.org
Cc: zohar@linux.ibm.com, roberto.sassu@huawei.com,
	Stefan Berger <stefanb@linux.ibm.com>
Subject: [ima-evm-utils: PATCH] shellcheck: Fix shellcheck v0.11.0 issues detected in fsverity.test
Date: Tue, 24 Mar 2026 17:26:38 -0400	[thread overview]
Message-ID: <20260324212638.739797-1-stefanb@linux.ibm.com> (raw)

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


                 reply	other threads:[~2026-03-24 21:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260324212638.739797-1-stefanb@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=roberto.sassu@huawei.com \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox