diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 3eece353ef90..2c8173b3e769 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am @@ -1,54 +1,57 @@ include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am EXTRA_DIST += README zedconfdir = $(sysconfdir)/zfs/zed.d dist_zedconf_DATA = \ zed-functions.sh \ zed.rc zedexecdir = $(zfsexecdir)/zed.d dist_zedexec_SCRIPTS = \ all-debug.sh \ all-syslog.sh \ data-notify.sh \ generic-notify.sh \ resilver_finish-notify.sh \ scrub_finish-notify.sh \ statechange-led.sh \ statechange-notify.sh \ vdev_clear-led.sh \ vdev_attach-led.sh \ pool_import-led.sh \ resilver_finish-start-scrub.sh \ trim_finish-notify.sh nodist_zedexec_SCRIPTS = history_event-zfs-list-cacher.sh SUBSTFILES += $(nodist_zedexec_SCRIPTS) zedconfdefaults = \ all-syslog.sh \ data-notify.sh \ history_event-zfs-list-cacher.sh \ resilver_finish-notify.sh \ scrub_finish-notify.sh \ statechange-led.sh \ statechange-notify.sh \ vdev_clear-led.sh \ vdev_attach-led.sh \ pool_import-led.sh \ resilver_finish-start-scrub.sh install-data-hook: $(MKDIR_P) "$(DESTDIR)$(zedconfdir)" for f in $(zedconfdefaults); do \ test -f "$(DESTDIR)$(zedconfdir)/$${f}" -o \ -L "$(DESTDIR)$(zedconfdir)/$${f}" || \ ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \ done chmod 0600 "$(DESTDIR)$(zedconfdir)/zed.rc" + +# False positive: 1>&"${ZED_FLOCK_FD}" looks suspiciously similar to a >&filename bash extension +CHECKBASHISMS_IGNORE = -e 'should be >word 2>&1' -e '&"$${ZED_FLOCK_FD}"' diff --git a/cmd/zed/zed.d/all-debug.sh b/cmd/zed/zed.d/all-debug.sh index 14b39caacd9d..824c9fe423d7 100755 --- a/cmd/zed/zed.d/all-debug.sh +++ b/cmd/zed/zed.d/all-debug.sh @@ -1,26 +1,22 @@ #!/bin/sh # # Log all environment variables to ZED_DEBUG_LOG. # # This can be a useful aid when developing/debugging ZEDLETs since it shows the # environment variables defined for each zevent. [ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc" . "${ZED_ZEDLET_DIR}/zed-functions.sh" : "${ZED_DEBUG_LOG:="${TMPDIR:="/tmp"}/zed.debug.log"}" zed_exit_if_ignoring_this_event -lockfile="$(basename -- "${ZED_DEBUG_LOG}").lock" +zed_lock "${ZED_DEBUG_LOG}" +{ + printenv | sort + echo +} 1>&"${ZED_FLOCK_FD}" +zed_unlock "${ZED_DEBUG_LOG}" -umask 077 -zed_lock "${lockfile}" -exec >> "${ZED_DEBUG_LOG}" - -printenv | sort -echo - -exec >&- -zed_unlock "${lockfile}" exit 0