From 0ae373c202d45b73fc1826fae1ed0ef3a5875695 Mon Sep 17 00:00:00 2001 From: Julian lechner Date: Fri, 11 Sep 2026 16:07:27 +0200 Subject: [PATCH] fix(installer): tolerate BOM, CRLF, and uppercase in older manifests (Bash) Bash's manifest reader stripped only the trailing newline, so a CRLF-terminated manifest left a stray \r on every hash, a UTF-8 BOM on the header line was folded into the "path" field, and an uppercase hash never matched sha256sum's lowercase output. Reproduced against a real manifest written by an earlier version of the PowerShell installer, where every single managed file was misreported as locally modified. Co-Authored-By: Claude Sonnet 5 --- scripts/lib/manifest.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/lib/manifest.sh b/scripts/lib/manifest.sh index 189b5f5..9a4ab38 100755 --- a/scripts/lib/manifest.sh +++ b/scripts/lib/manifest.sh @@ -24,8 +24,14 @@ read_managed_manifest() { [ -f "$path" ] || return 0 local rel hash first=1 while IFS=$'\t' read -r rel hash; do - if [ "$first" = 1 ]; then first=0; [ "$rel" = path ] && continue; fi + hash=${hash%$'\r'} # tolerate a CRLF-terminated manifest (read only strips the trailing \n) + if [ "$first" = 1 ]; then + first=0 + rel=${rel#$'\xef\xbb\xbf'} # tolerate a UTF-8 BOM on the header line + [ "$rel" = path ] && continue + fi [ -n "$rel" ] || continue + hash=$(printf '%s' "$hash" | tr '[:upper:]' '[:lower:]') # tolerate uppercase hashes from older manifests out_ref[$rel]=$hash done < "$path" }