fix(build): pin shell scripts to LF endings to unblock Docker builds on Windows clones#9
Open
Kures wants to merge 1 commit into
Open
fix(build): pin shell scripts to LF endings to unblock Docker builds on Windows clones#9Kures wants to merge 1 commit into
Kures wants to merge 1 commit into
Conversation
…on Windows clones
Without .gitattributes, git checking out the repository on Windows
auto-converts shell scripts to CRLF. Inside the alpine builder image,
bash chokes on the trailing CR and aborts the build with errors like:
/tmp/install-zig.sh: line 2: set: pipefail
: invalid option name
This is a clean reproducer:
1. Clone on Windows with default git autocrlf
2. docker compose up --build
3. Stage [builder 4/9] fails before zig is even installed.
Fix: add .gitattributes pinning *.sh, *.bash, Dockerfile to eol=lf.
Future clones are immune regardless of core.autocrlf setting.
No code changes. The same scripts work as before on Linux/macOS where
LF was already the local form.
Note for existing Windows clones: tracked files won't auto-renormalize
on pull. After pulling this fix, run
git rm --cached -r .
git checkout .
(or simpler: re-clone) to convert your working tree to LF.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR3 —
fix(build): pin shell scripts to LF endings to unblock Docker builds on Windows clonesBranch:
fix/shell-line-endingsThe bug
Without a
.gitattributes, git on Windows checks out shell scriptswith CRLF line endings (the default
core.autocrlf=truebehavior). Inside the alpine builder image usedby
Dockerfile, bash chokes on the trailing CR and aborts the build:pipefailitself is a perfectly valid bash option. The trailing\rmakes bash see the option name as
pipefail\r, which it does notrecognize.
Reproducer
core.autocrlf=true.cd nullboiler && docker compose up --build.[builder 4/9]fails before zig is even installed.The same clone on Linux/macOS works because their default is
core.autocrlf=input(or off), so files stay LF.The fix
Add
.gitattributespinning shell scripts and Dockerfiles to LF:text eol=lfoverrides any user-sidecore.autocrlfsetting. Afterthis PR merges, fresh clones produce LF working trees on every
platform; existing clones with CRLF working trees can re-normalize via:
Why this is a real issue worth fixing
docker compose up --buildfrom a Windows clonehits this. We hit it during this contribution work.
.gitattributeswith zero behavioral change onLinux/macOS (those checkouts already had LF).
not work on Windows.
Why review attention is low-risk
machines.
* text=autofinal rule preserves git's defaulttext-vs-binary detection for every other file type.