From 88af959b24301e6fb39ce6ae8b66bdb7e817c710 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 9 Jun 2021 12:21:24 -0700 Subject: [PATCH] Fix minor shellcheck 0.7.2 warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first warning of a misspelling is a false positive, so we annotate the script accordingly. As for the x-prefix warnings update the check to use the conventional '[ -z ]' syntax. all-syslog.sh:46:47: warning: Possible misspelling: ZEVENT_ZIO_OBJECT may not be assigned, but ZEVENT_ZIO_OBJSET is. [SC2153] make_gitrev.sh:53:6: note: Avoid x-prefix in comparisons as it no longer serves a purpose [SC2268] man-dates.sh:10:7: note: Avoid x-prefix in comparisons as it no longer serves a purpose [SC2268] Reviewed-by: Ahelenia ZiemiaƄska Reviewed-by: John Kennedy Signed-off-by: Brian Behlendorf Closes #12208 --- cmd/zed/zed.d/all-syslog.sh | 1 + scripts/make_gitrev.sh | 2 +- scripts/man-dates.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/zed/zed.d/all-syslog.sh b/cmd/zed/zed.d/all-syslog.sh index 270b1bc67e5c..b07cf0f295ad 100755 --- a/cmd/zed/zed.d/all-syslog.sh +++ b/cmd/zed/zed.d/all-syslog.sh @@ -42,6 +42,7 @@ fi msg="${msg} delay=$((ZEVENT_ZIO_DELAY / 1000000))ms" # list the bookmark data together +# shellcheck disable=SC2153 [ -n "${ZEVENT_ZIO_OBJSET}" ] && \ msg="${msg} bookmark=${ZEVENT_ZIO_OBJSET}:${ZEVENT_ZIO_OBJECT}:${ZEVENT_ZIO_LEVEL}:${ZEVENT_ZIO_BLKID}" diff --git a/scripts/make_gitrev.sh b/scripts/make_gitrev.sh index da21455332ab..e7f4ce8844d5 100755 --- a/scripts/make_gitrev.sh +++ b/scripts/make_gitrev.sh @@ -50,7 +50,7 @@ esac ZFS_GITREV=$({ cd "${top_srcdir}" && git describe --always --long --dirty 2>/dev/null; } || :) -if [ "x${ZFS_GITREV}" = x ] +if [ -z "${ZFS_GITREV}" ] then # If the source directory is not a git repository, check if the file # already exists (in the source) diff --git a/scripts/man-dates.sh b/scripts/man-dates.sh index 186d94639a56..39f1b5fb1324 100755 --- a/scripts/man-dates.sh +++ b/scripts/man-dates.sh @@ -7,6 +7,6 @@ set -eu find man -type f | while read -r i ; do git_date=$(git log -1 --date=short --format="%ad" -- "$i") - [ "x$git_date" = "x" ] && continue + [ -z "$git_date" ] && continue sed -i "s|^\.Dd.*|.Dd $(date -d "$git_date" "+%B %-d, %Y")|" "$i" done