diff --git a/.claude/memory/MEMORY.md b/.claude/memory/MEMORY.md index f7ee16e..494ccdd 100644 --- a/.claude/memory/MEMORY.md +++ b/.claude/memory/MEMORY.md @@ -93,3 +93,4 @@ - [Proposal: centralize config in identity.json](proposal_identity_centralization.md) — Rationale for the identity.json machine-config centralization (claudetools_root, ollama/python); now implemented. - [ACG MSP tool stack](reference_acg_msp_stack.md) — ScreenConnect/CW Control, Splashtop, Syncro, Datto RMM, Datto EDR/AV, GuruRMM are ACG's OWN tools; do not flag as foreign/threat on managed machines (Defender-off is expected when Datto AV is active). - [ACG Website Hosting](project_azcomputerguru_hosting.md) — azcomputerguru.com is hosted on IX Web Hosting via cPanel. +- [jq on Windows emits CRLF](feedback_jq_crlf_windows.md) — winget jq outputs CRLF; trailing \r silently breaks `for x in $(jq ...)` loops + read-from-@tsv. Override `jq(){ command jq "$@"|tr -d '\r'; }`. Windows-build-specific (passes on Mac/Linux). diff --git a/.claude/memory/feedback_jq_crlf_windows.md b/.claude/memory/feedback_jq_crlf_windows.md new file mode 100644 index 0000000..c8dd65d --- /dev/null +++ b/.claude/memory/feedback_jq_crlf_windows.md @@ -0,0 +1,14 @@ +--- +name: jq on Windows emits CRLF — strip \r in shell loops +description: The winget jq build on Windows outputs CRLF line endings; a trailing \r silently corrupts `for x in $(jq ...)` loops and `read`-from-@tsv fields in harness bash scripts +type: feedback +--- +The `jq` binary installed via winget on Windows (`C:\Users\\AppData\Local\Microsoft\WinGet\Links\jq.exe`) emits **CRLF** line endings on multi-line output. A trailing `\r` then rides along on every value and silently breaks shell scripts. + +**Why:** In `for x in $(jq -r '.arr[]')`, command substitution strips only the *final* trailing newline, so every interior word keeps its `\r` — `"1password\r"` instead of `"1password"`. Paths/dir-tests/`case` membership then fail for items that actually exist (false "missing"). Single-value `x="$(jq -r '.field')"` is unaffected because `$()` strips the whole trailing CRLF, which is why the bug hides until you hit a loop. Git Bash, macOS, and Linux jq do NOT do this — it's Windows-build-specific, so it passes review on a Mac/Linux box and breaks on Windows. + +**How to apply:** In any bash script that iterates jq output, neutralize it once at the top: +```bash +jq() { command jq "$@" | tr -d '\r'; } # override; \r is insignificant JSON whitespace, safe to strip everywhere +``` +Or pipe individual loop-feeding calls through `tr -d '\r'`. Stripping `\r` from jq output is always safe (it's JSON whitespace and never wanted in raw string values). First hit + fix: the `self-check` skill engine (`.claude/skills/self-check/scripts/self-check.sh`), 2026-06-02. Related: [[feedback_python_windows]].