From b076e2c0b3a8a83fe2b11dc1b09b1c9f72301db6 Mon Sep 17 00:00:00 2001 From: Ashlen Date: Wed, 15 Jul 2026 11:25:07 -0600 Subject: [PATCH] fix(ensure-shutdown): apply timeout default under nounset The script runs under 'set -o nounset'. When no config file assigns ENSURE_SHUTDOWN_TIMEOUT, the bare "${ENSURE_SHUTDOWN_TIMEOUT}" in the fallback guard raises an unbound-variable error and aborts before the guard can apply the default, so ExecStart never starts the shutdown monitor. Add the ':-' default in the -z test so the guard runs and falls back to 30. The sibling emerg-shutdown wrapper avoids this by pre-initializing its config variables before sourcing. --- usr/libexec/security-misc/ensure-shutdown#security-misc-shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/libexec/security-misc/ensure-shutdown#security-misc-shared b/usr/libexec/security-misc/ensure-shutdown#security-misc-shared index 85ab31dc..9a1cf1cf 100755 --- a/usr/libexec/security-misc/ensure-shutdown#security-misc-shared +++ b/usr/libexec/security-misc/ensure-shutdown#security-misc-shared @@ -20,7 +20,7 @@ for config_file in /etc/security-misc/emerg-shutdown/*.conf /usr/local/etc/secur source "${config_file}" fi done -if [ -z "${ENSURE_SHUTDOWN_TIMEOUT}" ] \ +if [ -z "${ENSURE_SHUTDOWN_TIMEOUT:-}" ] \ || ! is_whole_number "${ENSURE_SHUTDOWN_TIMEOUT}"; then ENSURE_SHUTDOWN_TIMEOUT=30; fi