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 <[email protected]>
---
 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 via email to