diff options
author | наб <[email protected]> | 2021-05-14 04:18:20 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-06-09 13:06:09 -0700 |
commit | 27d3cc6cd3230877dad0a2700b50cedb99b71e22 (patch) | |
tree | b109d3bbe8afec0eada0c184357679e92a7a5a55 /cmd/zed | |
parent | d6a0cecab142f25e4a031a645c6ce510aab6c15d (diff) |
zed.d/all-debug.sh: simplify
By locking the log file itself, we can omit arduous rebinding and
explicit umask setting, but, perhaps more importantly, avoid permanently
littering /var/lock/ with zed.debug.log.lock we will never delete
It is imperative that the previous commit
("zed-functions.sh: zed_lock(): don't truncate lock")
be included in any series that contains this one
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12042
Diffstat (limited to 'cmd/zed')
-rw-r--r-- | cmd/zed/zed.d/Makefile.am | 3 | ||||
-rwxr-xr-x | cmd/zed/zed.d/all-debug.sh | 16 |
2 files changed, 9 insertions, 10 deletions
diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 3eece353e..2c8173b3e 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am @@ -52,3 +52,6 @@ install-data-hook: 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 14b39caac..824c9fe42 100755 --- a/cmd/zed/zed.d/all-debug.sh +++ b/cmd/zed/zed.d/all-debug.sh @@ -12,15 +12,11 @@ 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 |