Stop a trailing comment in an allow file killing every run

cfg_read_allowlist() ended on `[[ -n "$line" ]] && CFG_allow+=(...)`, so a file whose
last line is a comment or blank returned 1 from the loop. load_config() calls it twice
in a non-final position, so under `set -e` every run died with exit 1 and no output at
all -- --dry-run and --print-policy included, with nothing to explain it.

Reading a file now always succeeds. An allowlist with nothing in it stays
validate_opts()'s call to refuse, with the message that says why.

LLM-Generated: true
This commit is contained in:
2026-10-30 22:50:04 -04:00
parent 9347bca78f
commit 8b70967907
2 changed files with 29 additions and 0 deletions
+7
View File
@@ -348,6 +348,13 @@ cfg_read_allowlist() { # one target per line
line="$(trim "${line%%#*}")"
[[ -n "$line" ]] && CFG_allow+=("$line")
done < "$file"
# A loop returns the status of the last command its body ran, and here that is the `&&`
# above: a file whose last line is a comment or blank would return 1. load_config() calls
# this twice in a non-final position, so under `set -e` every run would die with exit 1
# and no output at all -- previews included. A blank last line is not an error, so reading a
# file always succeeds; an allowlist with nothing in it is validate_opts()'s call to
# refuse, with a message, rather than a silent death here.
return 0
}
load_config() {