Skip to content

fix: preserve LF line endings for shell checkouts - #92

Open
Kewe63 wants to merge 1 commit into
inkonchain:mainfrom
Kewe63:fix/73-preserve-shell-lf
Open

Kewe63 wants to merge 1 commit into
inkonchain:mainfrom
Kewe63:fix/73-preserve-shell-lf

Conversation

@Kewe63

@Kewe63 Kewe63 commented Sep 14, 2026

Copy link
Copy Markdown

Summary

Fixes #73.

The repository's shell-script blobs already contain LF line endings. The failure occurs during checkout: with core.autocrlf=true, Git converts them to CRLF because the repository has no explicit shell-file EOL policy. Linux then cannot resolve the CR-terminated shebang interpreter; explicitly invoking a shell also fails on the CR-terminated shell statements.

  • Add *.sh text eol=lf to preserve LF in shell-script checkouts, including progress.sh and scripts mounted as Linux container entrypoints.
  • Add regression tests using the real repository shell files and actual Git index/checkout conversion in disposable repositories.
  • Do not rewrite already-LF scripts, change global Git settings, or normalize unrelated file types.

Verification

  • Before the rule: the regression's core.autocrlf=true case failed for all five scripts; false and input controls passed.
  • After the rule: python3 -m unittest discover -s tests -v passes all three cases with Git 2.43.0 on Linux.
  • GIT_BINARY='/mnt/c/Program Files/Git/cmd/git.exe' python3 -m unittest discover -s tests -v also passes all three cases with actual Git for Windows 2.52.0.windows.1, invoked from WSL.
  • Each case checks all five current shell scripts against the original bytes and rejects CRLF after checkout.
  • The fixture removes only its own temporary worktree copies before checkout-index so Git actually rematerializes the files rather than taking a stat-cache shortcut.
  • git diff --cached --check passes.

The preceding issue investigation separately reproduced failures by executing the actual CRLF checkouts in an isolated Linux environment: direct invocation returned 127 (missing CR-suffixed interpreter), explicit shell invocation returned 2, and LF controls succeeded. No Docker, live RPC, or existing node data was used.

Scope and limitations

This is a checkout policy fix, not a claim that the committed scripts contain CRLF or that every Windows setup is affected. Windows Git was tested through WSL using UNC paths; Docker Desktop end-to-end startup was not run.

The rule governs future checkout materialization. Adding it does not itself rewrite pre-existing CRLF working files: operators must preserve local edits and refresh affected files or use a fresh checkout after updating. No destructive refresh command or global configuration change is included.

This change is independent of the WebSocket fix in #91 and uses a separate test module. PR #83 concerns .env parsing, not shell-file checkout conversion.

Implementation and test preparation were AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell scripts initially in CRLF instead of LF (causing execution issues on Linux)

1 participant