From e0ee0965d66e5042453b6015c45ca2a4e9024b18 Mon Sep 17 00:00:00 2001 From: Hamed Sanaei Date: Wed, 2 Dec 2026 23:43:17 +0330 Subject: [PATCH] test(ssl): handle ShellCheck diagnostics for fault hooks --- scripts/test/ip-ssl-certificate-test.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/test/ip-ssl-certificate-test.sh b/scripts/test/ip-ssl-certificate-test.sh index 6aacedaff..eb49812d6 100644 --- a/scripts/test/ip-ssl-certificate-test.sh +++ b/scripts/test/ip-ssl-certificate-test.sh @@ -191,8 +191,9 @@ reject issue if ! live_is old || ! legacy_is_intact; then fail 'wrong key changed prior certificate or ACME state'; fi fixture new -# Fault hooks are called indirectly by the sourced lifecycle functions. -# shellcheck disable=SC2317 +# The chmod and mv overrides in this suite are called by the sourced lifecycle functions. +# Older ShellCheck reports SC2317 for these calls, and newer versions report SC2329. +# shellcheck disable=SC2317,SC2329 chmod() { if [[ "$1" == 600 && "$*" == *'/gen.'* ]]; then return 1; fi command chmod "$@" @@ -202,7 +203,7 @@ unset -f chmod if ! live_is old || ! legacy_is_intact; then fail 'chmod failure changed prior certificate or ACME state'; fi printf 'PASS: issuance, installation, SAN, key, partial and permission failures preserve prior state\n' -# shellcheck disable=SC2317 +# shellcheck disable=SC2317,SC2329 mv() { if [[ "$*" == *'.xui-retired-'* && "${!#}" == "$legacy/${ipv4}_ecc" ]]; then return 1; fi command mv "$@" @@ -216,7 +217,7 @@ reject issue legacy_is_intact || fail 'subsequent attempt did not finish ACME recovery' ISSUE_MODE=ok -# shellcheck disable=SC2317 +# shellcheck disable=SC2317,SC2329 mv() { if [[ "${!#}" == "$cert_dir/privkey.pem" || ( "$*" == *'/pending/restore '* && "${!#}" == "$cert_dir/fullchain.pem" ) ]]; then return 1 @@ -233,7 +234,7 @@ if ! live_is old || ! legacy_is_intact; then fail 'subsequent attempt did not fi [[ ! -L "$cert_dir/fullchain.pem" ]] || fail 'original regular file type was not recovered' ISSUE_MODE=ok -# shellcheck disable=SC2317 +# shellcheck disable=SC2317,SC2329 mv() { command mv "$@" || return if [[ "${!#}" == "$cert_dir/fullchain.pem" && "$*" == *'/pending/link '* ]]; then kill -KILL "$BASHPID"; fi @@ -296,7 +297,7 @@ if ! live_is new || ! cmp "$TEMP/working.conf" "$working_conf"; then fail 'rejec cat "$TEMP/tls.log" >&2 fail 'TLS restart could not load the last known-good certificate' ) -# shellcheck disable=SC2317 +# shellcheck disable=SC2317,SC2329 mv() { if [[ "${!#}" == "$state/current" ]]; then return 1; fi command mv "$@" @@ -341,7 +342,7 @@ printf 'PASS: manual, renewal and shared-destination promotion serialize; unrela # promote. Its new state must survive cleanup of the earlier transaction. promotion="$TEMP/promotion" mkfifo "$promotion" -# shellcheck disable=SC2317 +# shellcheck disable=SC2317,SC2329 mv() { if [[ "${!#}" == "$state/current" && "${FAIL_PROMOTION:-0}" == 1 ]]; then : > "$promotion.ready"