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 @@ -1,50 +1,51 @@ #!/bin/sh # # Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. # Copyright (c) 2020 by Delphix. All rights reserved. # # # Log the zevent via syslog. # [ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc" . "${ZED_ZEDLET_DIR}/zed-functions.sh" zed_exit_if_ignoring_this_event # build a string of name=value pairs for this event msg="eid=${ZEVENT_EID} class=${ZEVENT_SUBCLASS}" if [ "${ZED_SYSLOG_DISPLAY_GUIDS}" = "1" ]; then [ -n "${ZEVENT_POOL_GUID}" ] && msg="${msg} pool_guid=${ZEVENT_POOL_GUID}" [ -n "${ZEVENT_VDEV_GUID}" ] && msg="${msg} vdev_guid=${ZEVENT_VDEV_GUID}" else [ -n "${ZEVENT_POOL}" ] && msg="${msg} pool='${ZEVENT_POOL}'" [ -n "${ZEVENT_VDEV_PATH}" ] && msg="${msg} vdev=$(basename "${ZEVENT_VDEV_PATH}")" fi # log pool state if state is anything other than 'ACTIVE' [ -n "${ZEVENT_POOL_STATE_STR}" ] && [ "$ZEVENT_POOL_STATE" -ne 0 ] && \ msg="${msg} pool_state=${ZEVENT_POOL_STATE_STR}" # Log the following payload nvpairs if they are present [ -n "${ZEVENT_VDEV_STATE_STR}" ] && msg="${msg} vdev_state=${ZEVENT_VDEV_STATE_STR}" [ -n "${ZEVENT_CKSUM_ALGORITHM}" ] && msg="${msg} algorithm=${ZEVENT_CKSUM_ALGORITHM}" [ -n "${ZEVENT_ZIO_SIZE}" ] && msg="${msg} size=${ZEVENT_ZIO_SIZE}" [ -n "${ZEVENT_ZIO_OFFSET}" ] && msg="${msg} offset=${ZEVENT_ZIO_OFFSET}" [ -n "${ZEVENT_ZIO_PRIORITY}" ] && msg="${msg} priority=${ZEVENT_ZIO_PRIORITY}" [ -n "${ZEVENT_ZIO_ERR}" ] && msg="${msg} err=${ZEVENT_ZIO_ERR}" [ -n "${ZEVENT_ZIO_FLAGS}" ] && msg="${msg} flags=$(printf '0x%x' "${ZEVENT_ZIO_FLAGS}")" # log delays that are >= 10 milisec [ -n "${ZEVENT_ZIO_DELAY}" ] && [ "$ZEVENT_ZIO_DELAY" -gt 10000000 ] && \ 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}" zed_log_msg "${msg}" exit 0 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 @@ -1,78 +1,78 @@ #!/bin/sh # # CDDL HEADER START # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # CDDL HEADER END # # Copyright (c) 2018 by Delphix. All rights reserved. # Copyright (c) 2018 by Matthew Thode. All rights reserved. # # Generate zfs_gitrev.h. Note that we need to do this for every # invocation of `make`, including for incremental builds. Therefore we # can't use a zfs_gitrev.h.in file which would be processed only when # `configure` is run. # set -e -u dist=no distdir=. while getopts D: flag do case $flag in \?) echo "Usage: $0 [-D distdir] [file]" >&2; exit 1;; D) dist=yes; distdir=${OPTARG};; esac done shift $((OPTIND - 1)) top_srcdir="$(dirname "$0")/.." GITREV="${1:-include/zfs_gitrev.h}" # GITREV should be a relative path (relative to top_builddir or distdir) case "${GITREV}" in /*) echo "Error: ${GITREV} should be a relative path" >&2 exit 1;; 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) if [ -f "${top_srcdir}/${GITREV}" ] then ZFS_GITREV=$(sed -n \ '1s/^#define[[:blank:]]ZFS_META_GITREV "\([^"]*\)"$/\1/p' \ "${top_srcdir}/${GITREV}") fi elif [ ${dist} = yes ] then # Append -dist when creating distributed sources from a git repository ZFS_GITREV="${ZFS_GITREV}-dist" fi ZFS_GITREV=${ZFS_GITREV:-unknown} GITREVTMP="${GITREV}~" printf '#define\tZFS_META_GITREV "%s"\n' "${ZFS_GITREV}" >"${GITREVTMP}" GITREV="${distdir}/${GITREV}" if cmp -s "${GITREV}" "${GITREVTMP}" then rm -f "${GITREVTMP}" else mv -f "${GITREVTMP}" "${GITREV}" fi 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 @@ -1,12 +1,12 @@ #!/bin/sh # This script updates the date lines in the man pages to the date of the last # commit to that file. 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