From 6c0aa87389b75cb1dc03bdfb70e1bf71aaa0d6ca Mon Sep 17 00:00:00 2001 From: tw93 Date: Thu, 26 Feb 2026 19:42:52 +0800 Subject: [PATCH] fix(clean): guard DRY_RUN against unbound variable in system.sh Change "$DRY_RUN" to "${DRY_RUN:-}" so the check is safe under set -euo pipefail when DRY_RUN is not exported by the caller (e.g. unit tests that source lib/clean/system.sh directly without going through bin/clean.sh which initialises the variable). --- lib/clean/system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clean/system.sh b/lib/clean/system.sh index 5cc5e93..982ac32 100644 --- a/lib/clean/system.sh +++ b/lib/clean/system.sh @@ -186,7 +186,7 @@ clean_deep_system() { done < <(sudo find "$mem_reports_dir" -type f -mtime +30 -print0 2> /dev/null || true) if [[ "$file_count" -gt 0 ]]; then - if [[ "$DRY_RUN" != "true" ]]; then + if [[ "${DRY_RUN:-}" != "true" ]]; then if safe_sudo_find_delete "$mem_reports_dir" "*" "30" "f"; then mem_cleaned=1 fi