test(ssl): handle ShellCheck diagnostics for fault hooks

This commit is contained in:
Hamed Sanaei
2026-12-02 23:43:17 +03:30
parent 6ad00e3149
commit e0ee0965d6
+8 -7
View File
@@ -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"