From c8ed309275253d635f8a6f3b15263506520d9b35 Mon Sep 17 00:00:00 2001 From: Jah-yee <166608075+Jah-yee@users.noreply.github.com> Date: Wed, 27 May 2026 02:45:29 +0800 Subject: [PATCH] fix: match typeset in readonly guard for zsh compatibility In zsh, readonly variables are reported with 'typeset' instead of 'declare', causing the re-sourcing guard to miss the variable and attempt to redeclare it, triggering 'read-only variable' errors. Closes #112 --- logging.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging.sh b/logging.sh index dc16988..dd97c29 100644 --- a/logging.sh +++ b/logging.sh @@ -53,7 +53,7 @@ # Version (updated by release workflow) # Guard against re-initialization when sourced multiple times # Use readonly status instead of emptiness to avoid environment bypass -if ! readonly -p 2>/dev/null | grep -q "declare -[^ ]*r[^ ]* BASH_LOGGER_VERSION="; then +if ! readonly -p 2>/dev/null | grep -qE '(declare|typeset) -[^ ]*r[^ ]* BASH_LOGGER_VERSION='; then readonly BASH_LOGGER_VERSION="2.5.1" # Unset potentially malicious environment variables before setting internal constants