summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamian Szuberski <30863496+szubersk@users.noreply.github.com>2021-11-30 19:23:10 +0100
committerGitHub <noreply@github.com>2021-11-30 10:23:10 -0800
commit34eef3e9a7a74d24a59d016051d547afc55dbaa0 (patch)
treec75ff6fda4ee9582ed2ebb5b1a71a529242c3d78
parent4325de09cd2993837bc32a83d61872b57e58298e (diff)
Pass `--enable=all` to shellcheck within contrib/
- Remove `SHELLCHECK_IGNORE` in favor of inline suppressions and more general `SHELLCHECK_OPTS`. - Exclude `SC2250` (turned on by `--enable=all`) globally - Pass `--enable=all` to shellcheck for scripts in contrib/: it's very important to catch errors early in areas that are not easily testable. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: szubersk <szuberskidamian@gmail.com> Closes #12760
-rw-r--r--config/Shellcheck.am2
-rw-r--r--contrib/Makefile.am1
-rw-r--r--contrib/bash_completion.d/Makefile.am2
-rw-r--r--contrib/bash_completion.d/zfs.in60
-rw-r--r--contrib/bpftrace/Makefile.am1
-rw-r--r--contrib/dracut/02zfsexpandknowledge/Makefile.am1
-rw-r--r--contrib/dracut/90zfs/Makefile.am1
-rwxr-xr-xcontrib/dracut/90zfs/export-zfs.sh.in2
-rwxr-xr-xcontrib/dracut/90zfs/import-opts-generator.sh.in1
-rwxr-xr-xcontrib/dracut/90zfs/module-setup.sh.in6
-rwxr-xr-xcontrib/dracut/90zfs/parse-zfs.sh.in5
-rwxr-xr-xcontrib/dracut/90zfs/zfs-lib.sh.in12
-rw-r--r--contrib/initramfs/Makefile.am1
-rw-r--r--contrib/initramfs/hooks/Makefile.am1
-rwxr-xr-xcontrib/initramfs/hooks/zfs.in4
-rw-r--r--contrib/initramfs/scripts/Makefile.am1
-rw-r--r--contrib/initramfs/scripts/local-top/Makefile.am2
-rw-r--r--contrib/initramfs/scripts/zfs7
-rw-r--r--etc/default/Makefile.am1
-rw-r--r--etc/default/zfs.in1
-rw-r--r--scripts/Makefile.am1
-rwxr-xr-xscripts/mancheck.sh2
22 files changed, 65 insertions, 50 deletions
diff --git a/config/Shellcheck.am b/config/Shellcheck.am
index 6b805b797..e255e6733 100644
--- a/config/Shellcheck.am
+++ b/config/Shellcheck.am
@@ -1,7 +1,7 @@
.PHONY: shellcheck
shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS)
if HAVE_SHELLCHECK
- [ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") --exclude=SC1090,SC1091$(SHELLCHECK_IGNORE) --format=gcc $(SCRIPTS) $(SHELLCHECKSCRIPTS)
+ [ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck --format=gcc --exclude=SC1090,SC1091,SC2250 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") $(SHELLCHECK_OPTS) $(SCRIPTS) $(SHELLCHECKSCRIPTS)
else
@[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed"
endif
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 5ec13ece5..f13b5f9f6 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -10,3 +10,4 @@ endif
DIST_SUBDIRS = bash_completion.d bpftrace dracut initramfs pam_zfs_key pyzfs zcp
SHELLCHECKDIRS = bash_completion.d bpftrace dracut initramfs
+SHELLCHECK_OPTS = --enable=all
diff --git a/contrib/bash_completion.d/Makefile.am b/contrib/bash_completion.d/Makefile.am
index 8c8d1aceb..f381613ed 100644
--- a/contrib/bash_completion.d/Makefile.am
+++ b/contrib/bash_completion.d/Makefile.am
@@ -10,4 +10,4 @@ SUBSTFILES += $(noinst_DATA)
SHELLCHECKSCRIPTS = $(noinst_DATA)
SHELLCHECK_SHELL = bash
-SHELLCHECK_IGNORE = ,SC2207
+SHELLCHECK_OPTS = --enable=all
diff --git a/contrib/bash_completion.d/zfs.in b/contrib/bash_completion.d/zfs.in
index 41ce2f871..6b467d80c 100644
--- a/contrib/bash_completion.d/zfs.in
+++ b/contrib/bash_completion.d/zfs.in
@@ -185,9 +185,9 @@ __zfs_complete_ordered_arguments()
# shellcheck disable=SC2086
if __zfs_argument_chosen $list1
then
- COMPREPLY=($(compgen -W "$list2 $extra" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$list2 $extra" -- "$cur")
else
- COMPREPLY=($(compgen -W "$list1 $extra" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$list1 $extra" -- "$cur")
fi
}
@@ -197,9 +197,9 @@ __zfs_complete_multiple_options()
local cur=$2
local existing_opts
- COMPREPLY=($(compgen -W "$options" -- "${cur##*,}"))
+ mapfile -t COMPREPLY < <(compgen -W "$options" -- "${cur##*,}")
existing_opts=$(expr "$cur" : '\(.*,\)')
- if [[ $existing_opts ]]
+ if [ -n "$existing_opts" ]
then
COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
fi
@@ -210,7 +210,7 @@ __zfs_complete_switch()
local options=$1
if [[ ${cur:0:1} == - ]]
then
- COMPREPLY=($(compgen -W "-{$options}" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "-{$options}" -- "$cur")
return 0
else
return 1
@@ -244,7 +244,7 @@ __zfs_complete()
if [[ ${prev##*/} == zfs ]]
then
cmds=$(__zfs_get_commands)
- COMPREPLY=($(compgen -W "$cmds -?" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$cmds -?" -- "$cur")
return 0
fi
@@ -252,15 +252,15 @@ __zfs_complete()
bookmark)
if __zfs_argument_chosen
then
- COMPREPLY=($(compgen -W "${prev%@*}# ${prev/@/#}" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "${prev%@*}# ${prev/@/#}" -- "$cur")
else
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
fi
;;
clone)
case "${prev}" in
-o)
- COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_get_editable_properties)" -- "$cur")
__zfs_complete_nospace
;;
*)
@@ -268,9 +268,9 @@ __zfs_complete()
then
if __zfs_argument_chosen
then
- COMPREPLY=($(compgen -W "$(__zfs_list_datasets)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_list_datasets)" -- "$cur")
else
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
fi
fi
;;
@@ -279,7 +279,7 @@ __zfs_complete()
get)
case "${prev}" in
-d)
- COMPREPLY=($(compgen -W "" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "" -- "$cur")
;;
-t)
__zfs_complete_multiple_options "filesystem volume snapshot bookmark all" "$cur"
@@ -296,7 +296,7 @@ __zfs_complete()
# shellcheck disable=SC2046
if __zfs_argument_chosen $(__zfs_get_properties)
then
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
else
__zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur"
fi
@@ -313,7 +313,7 @@ __zfs_complete()
list)
case "${prev}" in
-d)
- COMPREPLY=($(compgen -W "" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "" -- "$cur")
;;
-t)
__zfs_complete_multiple_options "filesystem volume snapshot bookmark all" "$cur"
@@ -322,23 +322,23 @@ __zfs_complete()
__zfs_complete_multiple_options "$(__zfs_get_properties)" "$cur"
;;
-s|-S)
- COMPREPLY=($(compgen -W "$(__zfs_get_properties)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_get_properties)" -- "$cur")
;;
*)
if ! __zfs_complete_switch "H,r,d,o,t,s,S"
then
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
fi
;;
esac
;;
promote)
- COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_list_filesystems)" -- "$cur")
;;
rollback)
if ! __zfs_complete_switch "r,R,f"
then
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
fi
;;
send)
@@ -346,13 +346,13 @@ __zfs_complete()
then
if __zfs_argument_chosen
then
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
else
if [[ $prev == -*i* ]]
then
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot_or_bookmark)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot_or_bookmark)" -- "$cur")
else
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
fi
fi
fi
@@ -360,13 +360,13 @@ __zfs_complete()
snapshot)
case "${prev}" in
-o)
- COMPREPLY=($(compgen -W "$(__zfs_get_editable_properties)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_get_editable_properties)" -- "$cur")
__zfs_complete_nospace
;;
*)
if ! __zfs_complete_switch "o,r"
then
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
__zfs_complete_nospace
fi
;;
@@ -379,12 +379,12 @@ __zfs_complete()
upgrade)
case "${prev}" in
-a|-V|-v)
- COMPREPLY=($(compgen -W "" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "" -- "$cur")
;;
*)
if ! __zfs_complete_switch "a,V,v,r"
then
- COMPREPLY=($(compgen -W "$(__zfs_list_filesystems)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_list_filesystems)" -- "$cur")
fi
;;
esac
@@ -397,7 +397,7 @@ __zfs_complete()
fi
;;
*)
- COMPREPLY=($(compgen -W "$(__zfs_match_snapshot)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zfs_match_snapshot)" -- "$cur")
;;
esac
if type __ltrim_colon_completions &> /dev/null
@@ -438,7 +438,7 @@ __zpool_complete()
if [[ ${prev##*/} == zpool ]]
then
cmds=$(__zpool_get_commands)
- COMPREPLY=($(compgen -W "$cmds" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$cmds" -- "$cur")
return 0
fi
@@ -452,7 +452,7 @@ __zpool_complete()
then
_filedir -d
else
- COMPREPLY=($(compgen -W "$(__zpool_list_pools) -d" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zpool_list_pools) -d" -- "$cur")
fi
return 0
;;
@@ -468,12 +468,12 @@ __zpool_complete()
then
_filedir
else
- COMPREPLY=($(compgen -W "$pools" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$pools" -- "$cur")
fi
return 0
;;
*)
- COMPREPLY=($(compgen -W "$(__zpool_list_pools)" -- "$cur"))
+ mapfile -t COMPREPLY < <(compgen -W "$(__zpool_list_pools)" -- "$cur")
return 0
;;
esac
diff --git a/contrib/bpftrace/Makefile.am b/contrib/bpftrace/Makefile.am
index 05e4f1c50..87732331f 100644
--- a/contrib/bpftrace/Makefile.am
+++ b/contrib/bpftrace/Makefile.am
@@ -5,3 +5,4 @@ EXTRA_DIST = \
zfs-trace.sh
SHELLCHECKSCRIPTS = zfs-trace.sh
+SHELLCHECK_OPTS = --enable=all
diff --git a/contrib/dracut/02zfsexpandknowledge/Makefile.am b/contrib/dracut/02zfsexpandknowledge/Makefile.am
index b1bbb6bd3..cdf06202b 100644
--- a/contrib/dracut/02zfsexpandknowledge/Makefile.am
+++ b/contrib/dracut/02zfsexpandknowledge/Makefile.am
@@ -5,4 +5,5 @@ pkgdracutdir = $(dracutdir)/modules.d/02zfsexpandknowledge
pkgdracut_SCRIPTS = \
module-setup.sh
+SHELLCHECK_OPTS = --enable=all
SUBSTFILES += $(pkgdracut_SCRIPTS)
diff --git a/contrib/dracut/90zfs/Makefile.am b/contrib/dracut/90zfs/Makefile.am
index 3f7050300..d25a3d250 100644
--- a/contrib/dracut/90zfs/Makefile.am
+++ b/contrib/dracut/90zfs/Makefile.am
@@ -19,6 +19,7 @@ pkgdracut_DATA = \
zfs-rollback-bootfs.service
SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA)
+SHELLCHECK_OPTS = --enable=all
# Provided by /bin/sleep, and, again, every implementation of that supports this
CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.'
diff --git a/contrib/dracut/90zfs/export-zfs.sh.in b/contrib/dracut/90zfs/export-zfs.sh.in
index 892650383..9ad72bd6f 100755
--- a/contrib/dracut/90zfs/export-zfs.sh.in
+++ b/contrib/dracut/90zfs/export-zfs.sh.in
@@ -20,7 +20,7 @@ _do_zpool_export() {
zpool list 2>&1 | vinfo
fi
- return ${ret}
+ return "${ret}"
}
if command -v zpool >/dev/null; then
diff --git a/contrib/dracut/90zfs/import-opts-generator.sh.in b/contrib/dracut/90zfs/import-opts-generator.sh.in
index 8bc8c9b35..1900676f3 100755
--- a/contrib/dracut/90zfs/import-opts-generator.sh.in
+++ b/contrib/dracut/90zfs/import-opts-generator.sh.in
@@ -2,4 +2,5 @@
. /lib/dracut-zfs-lib.sh
+# shellcheck disable=SC2154
echo ZPOOL_IMPORT_OPTS="$ZPOOL_IMPORT_OPTS"
diff --git a/contrib/dracut/90zfs/module-setup.sh.in b/contrib/dracut/90zfs/module-setup.sh.in
index c27f905bf..10f915b2e 100755
--- a/contrib/dracut/90zfs/module-setup.sh.in
+++ b/contrib/dracut/90zfs/module-setup.sh.in
@@ -61,9 +61,9 @@ install() {
dracut_install /usr/lib*/gcc/**/libgcc_s.so*
fi
# shellcheck disable=SC2050
- if [ @LIBFETCH_DYNAMIC@ != 0 ]; then
+ if [ "@LIBFETCH_DYNAMIC@" != 0 ]; then
for d in $libdirs; do
- [ -e "$d/"@LIBFETCH_SONAME@ ] && dracut_install "$d/"@LIBFETCH_SONAME@
+ [ -e "$d/@LIBFETCH_SONAME@" ] && dracut_install "$d/@LIBFETCH_SONAME@"
done
fi
dracut_install @mounthelperdir@/mount.zfs
@@ -107,7 +107,7 @@ install() {
for _service in "zfs-import-scan.service" "zfs-import-cache.service" ; do
dracut_install "@systemdunitdir@/$_service"
if ! [ -L "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service" ]; then
- ln -sf ../$_service "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service"
+ ln -sf "../$_service" "${initdir}/$systemdsystemunitdir/zfs-import.target.wants/$_service"
type mark_hostonly >/dev/null 2>&1 && mark_hostonly "@systemdunitdir@/$_service"
fi
done
diff --git a/contrib/dracut/90zfs/parse-zfs.sh.in b/contrib/dracut/90zfs/parse-zfs.sh.in
index 0f92f5c80..724c5e2c6 100755
--- a/contrib/dracut/90zfs/parse-zfs.sh.in
+++ b/contrib/dracut/90zfs/parse-zfs.sh.in
@@ -49,11 +49,14 @@ case "${root}" in
info "ZFS: Set ${root} as bootfs."
;;
+
+ *)
+ info "ZFS: no ZFS-on-root"
esac
# Make sure Dracut is happy that we have a root and will wait for ZFS
# modules to settle before mounting.
-if [ ${wait_for_zfs} -eq 1 ]; then
+if [ "${wait_for_zfs}" -eq 1 ]; then
ln -s /dev/null /dev/root 2>/dev/null
initqueuedir="${hookdir}/initqueue/finished"
test -d "${initqueuedir}" || {
diff --git a/contrib/dracut/90zfs/zfs-lib.sh.in b/contrib/dracut/90zfs/zfs-lib.sh.in
index defc0bfc8..d7c3e96c1 100755
--- a/contrib/dracut/90zfs/zfs-lib.sh.in
+++ b/contrib/dracut/90zfs/zfs-lib.sh.in
@@ -70,6 +70,7 @@ import_pool() {
}
_mount_dataset_cb() {
+ # shellcheck disable=SC2154
mount -o zfsutil -t zfs "${1}" "${NEWROOT}${2}"
}
@@ -91,7 +92,7 @@ mount_dataset() {
fi
fi
- return ${ret}
+ return "${ret}"
}
# for_relevant_root_children DATASET EXEC
@@ -117,7 +118,7 @@ for_relevant_root_children() {
;;
esac
done
- exit ${_ret}
+ exit "${_ret}"
)
}
@@ -134,7 +135,7 @@ export_all() {
done
IFS="${OLDIFS}"
- return ${ret}
+ return "${ret}"
}
# ask_for_password
@@ -171,6 +172,7 @@ ask_for_password() {
--ply-tries) ply_tries="$2"; shift;;
--tty-tries) tty_tries="$2"; shift;;
--tty-echo-off) tty_echo_off=yes;;
+ *) echo "ask_for_password(): wrong opt '$1'" >&2;;
esac
shift
done
@@ -202,6 +204,6 @@ ask_for_password() {
fi
} 9>/.console_lock
- [ $ret -ne 0 ] && echo "Wrong password" >&2
- return $ret
+ [ "$ret" -ne 0 ] && echo "Wrong password" >&2
+ return "$ret"
}
diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am
index 931ceb131..76e66216c 100644
--- a/contrib/initramfs/Makefile.am
+++ b/contrib/initramfs/Makefile.am
@@ -7,6 +7,7 @@ dist_initrd_SCRIPTS = \
SUBDIRS = conf.d conf-hooks.d hooks scripts
SHELLCHECKDIRS = hooks scripts
+SHELLCHECK_OPTS = --enable=all
EXTRA_DIST = \
README.initramfs.markdown
diff --git a/contrib/initramfs/hooks/Makefile.am b/contrib/initramfs/hooks/Makefile.am
index 0cd1aafcd..7fb7a7528 100644
--- a/contrib/initramfs/hooks/Makefile.am
+++ b/contrib/initramfs/hooks/Makefile.am
@@ -7,4 +7,5 @@ hooks_SCRIPTS = \
zfs \
zfsunlock
+SHELLCHECK_OPTS = --enable=all
SUBSTFILES += $(hooks_SCRIPTS)
diff --git a/contrib/initramfs/hooks/zfs.in b/contrib/initramfs/hooks/zfs.in
index 9d5c397cf..176a1568e 100755
--- a/contrib/initramfs/hooks/zfs.in
+++ b/contrib/initramfs/hooks/zfs.in
@@ -30,8 +30,8 @@ find /lib/ -type f -name "libgcc_s.so.[1-9]" | while read -r libgcc; do
done
# shellcheck disable=SC2050
-if [ @LIBFETCH_DYNAMIC@ != 0 ]; then
- find /lib/ -name @LIBFETCH_SONAME@ | while read -r libfetch; do
+if [ "@LIBFETCH_DYNAMIC@" != 0 ]; then
+ find /lib/ -name "@LIBFETCH_SONAME@" | while read -r libfetch; do
copy_exec "$libfetch"
done
fi
diff --git a/contrib/initramfs/scripts/Makefile.am b/contrib/initramfs/scripts/Makefile.am
index 444a5f374..470fd792b 100644
--- a/contrib/initramfs/scripts/Makefile.am
+++ b/contrib/initramfs/scripts/Makefile.am
@@ -9,3 +9,4 @@ SUBDIRS = local-top
SHELLCHECKDIRS = $(SUBDIRS)
SHELLCHECK_SHELL = sh
+SHELLCHECK_OPTS = --enable=all
diff --git a/contrib/initramfs/scripts/local-top/Makefile.am b/contrib/initramfs/scripts/local-top/Makefile.am
index 897f9b2e2..a4bb907dd 100644
--- a/contrib/initramfs/scripts/local-top/Makefile.am
+++ b/contrib/initramfs/scripts/local-top/Makefile.am
@@ -4,3 +4,5 @@ localtopdir = /usr/share/initramfs-tools/scripts/local-top
dist_localtop_SCRIPTS = \
zfs
+
+SHELLCHECK_OPTS = --enable=all
diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs
index ccb42ce10..fcb712cff 100644
--- a/contrib/initramfs/scripts/zfs
+++ b/contrib/initramfs/scripts/zfs
@@ -596,7 +596,7 @@ setup_snapshot_booting()
retval=0
# Make sure that the snapshot specified actually exists.
- if [ ! "$(get_fs_value "${snap}" type)" ]
+ if [ -z "$(get_fs_value "${snap}" type)" ]
then
# Snapshot does not exist (...@<null> ?)
# ask the user for a snapshot to use.
@@ -613,7 +613,8 @@ setup_snapshot_booting()
then
# If the destination dataset for the clone
# already exists, destroy it. Recursively
- if [ "$(get_fs_value "${rootfs}_${snapname}" type)" ]; then
+ if [ -n "$(get_fs_value "${rootfs}_${snapname}" type)" ]
+ then
filesystems=$("${ZFS}" list -oname -tfilesystem -H \
-r -Sname "${ZFS_BOOTFS}")
for fs in $filesystems; do
@@ -848,7 +849,7 @@ mountroot()
done
IFS="$OLD_IFS"
- [ "$quiet" != "y" ] && zfs_log_end_msg $ZFS_ERROR
+ [ "$quiet" != "y" ] && zfs_log_end_msg "$ZFS_ERROR"
else
# No auto - use value from the command line option.
diff --git a/etc/default/Makefile.am b/etc/default/Makefile.am
index b88eb5494..0f7c96698 100644
--- a/etc/default/Makefile.am
+++ b/etc/default/Makefile.am
@@ -6,4 +6,3 @@ initconf_SCRIPTS = zfs
SUBSTFILES += $(initconf_SCRIPTS)
SHELLCHECK_SHELL = sh
-SHELLCHECK_IGNORE = ,SC2034
diff --git a/etc/default/zfs.in b/etc/default/zfs.in
index 3b6e5486d..93d98058e 100644
--- a/etc/default/zfs.in
+++ b/etc/default/zfs.in
@@ -8,6 +8,7 @@
# To enable a boolean setting, set it to yes, on, true, or 1.
# Anything else will be interpreted as unset.
+# shellcheck disable=SC2034
# Run `zfs mount -a` during system start?
ZFS_MOUNT='yes'
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 6c59fd7d4..77b1269a9 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -27,7 +27,6 @@ EXTRA_DIST = \
zol2zfs-patch.sed \
$(EXTRA_SCRIPTS)
-SHELLCHECK_IGNORE = ,SC1117
SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS)
define EXTRA_ENVIRONMENT
diff --git a/scripts/mancheck.sh b/scripts/mancheck.sh
index 0793cc48f..347b2e086 100755
--- a/scripts/mancheck.sh
+++ b/scripts/mancheck.sh
@@ -11,7 +11,7 @@
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
-# shellcheck disable=SC2086,SC2250
+# shellcheck disable=SC2086
trap 'rm -f "$stdout_file" "$stderr_file" "$result_file"' EXIT