Enforce LF line endings for everything that runs in the VM #1

Open
opened 2026-10-01 09:20:27 +00:00 by jan · 0 comments
Owner

Problem

On a Windows checkout with core.autocrlf=true (the Git for Windows default),
the scripts come out with CRLF:

$ file template/claude-agent
template/claude-agent: Bourne-Again shell script, ASCII text executable, with CRLF line terminators

agentbox create and agentbox update copy template/* into the Linux VM with
sbx cp. A script with CRLF fails there with /usr/bin/env: 'bash\r': No such file or directory. The same applies to bin/agentbox and lib/ when run from
Git Bash, which tolerates it less consistently.

This is not Windows-only: anyone who clones with autocrlf, or edits in an editor
that writes CRLF, produces a broken template.

Proposal

  • Add .gitattributes:

    * text=auto eol=lf
    *.tar binary
    
  • Add an offline test that fails when any file under bin/, lib/,
    scripts/, template/ or install.sh contains \r.

  • Optionally: install.sh and the code paths that sbx cp files into the VM refuse a file
    containing \r, with a message pointing at .gitattributes. That catches a
    working tree that was checked out before the attribute existed.

Done when

  • A fresh clone with core.autocrlf=true produces LF files.
  • tests/run-tests.sh has a test for CR bytes and it passes.
## Problem On a Windows checkout with `core.autocrlf=true` (the Git for Windows default), the scripts come out with CRLF: ```text $ file template/claude-agent template/claude-agent: Bourne-Again shell script, ASCII text executable, with CRLF line terminators ``` `agentbox create` and `agentbox update` copy `template/*` into the Linux VM with `sbx cp`. A script with CRLF fails there with `/usr/bin/env: 'bash\r': No such file or directory`. The same applies to `bin/agentbox` and `lib/` when run from Git Bash, which tolerates it less consistently. This is not Windows-only: anyone who clones with autocrlf, or edits in an editor that writes CRLF, produces a broken template. ## Proposal - Add `.gitattributes`: ```text * text=auto eol=lf *.tar binary ``` - Add an offline test that fails when any file under `bin/`, `lib/`, `scripts/`, `template/` or `install.sh` contains `\r`. - Optionally: `install.sh` and the code paths that `sbx cp` files into the VM refuse a file containing `\r`, with a message pointing at `.gitattributes`. That catches a working tree that was checked out before the attribute existed. ## Done when - A fresh clone with `core.autocrlf=true` produces LF files. - `tests/run-tests.sh` has a test for CR bytes and it passes.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jan/agentbox#1
No description provided.