From cb8c131bc493e2d37fb4ac810d1ffbbace2c2545 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Apr 2026 20:29:44 +0000 Subject: [PATCH] fix: clear EXIT trap before return to avoid unbound $tmpdir under set -u Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/backup.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/backup.sh b/lib/backup.sh index 8b4c858..8d7a827 100644 --- a/lib/backup.sh +++ b/lib/backup.sh @@ -128,4 +128,9 @@ backup_create() { local size size=$(du -h "$outfile" | cut -f1) echo "=== Backup complete: ${outfile} (${size}) ===" + + # Clean up before returning — the EXIT trap references the local $tmpdir + # which goes out of scope after return, causing 'unbound variable' under set -u. + trap - EXIT + rm -rf "$tmpdir" }