From 37252ec974cce627fdbc5520985a5bfdb5b75d8d Mon Sep 17 00:00:00 2001 From: Chris Dunlap Date: Tue, 1 Jul 2025 21:37:30 -0700 Subject: [PATCH] Fix zsh parsing error on NetBSD The zsh-specific parameter expansion ${(%):-%x} introduced in commit 96e0ea2c7 causes a parse error on NetBSD where /bin/sh cannot parse this syntax, even though it is inside a zsh-only conditional block. The error occurs because the shell must parse the entire script before execution, and NetBSD's /bin/sh fails when it encounters the zsh-specific syntax with: "Syntax error: Bad substitution". Wrap the assignment in eval to defer parsing until runtime, when the script is actually running under zsh. This maintains the fix for the NO_FUNCTION_ARGZERO option while restoring compatibility with NetBSD's /bin/sh. --- sharness.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sharness.sh b/sharness.sh index ec9cb01ab..3dc018439 100644 --- a/sharness.sh +++ b/sharness.sh @@ -21,7 +21,7 @@ if test -n "${ZSH_VERSION-}" then # shellcheck disable=SC2296 - SHARNESS_SOURCE=${(%):-%x} + eval 'SHARNESS_SOURCE=${(%):-%x}' emulate sh -o POSIX_ARGZERO else # shellcheck disable=SC3028