CCExtractor / CCExtractor/ccextractor
[BUG] No .gitattributes: Windows clones get CRLF shebangs and the documented Linux/Docker build fails with "/usr/bin/env: 'bash\r': No such file or directory"
- Dominant language
- C
- Stars
- 903
- Forks
- 589
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 10
Description
CCExtractor version: master (2364994a)
# Necessary information
- Is this a regression (i.e. did it work before)? **NO** — the repo has never had a `.gitattributes`.
- What platform did you use? **Windows** (clone side). The failure shows up on any Linux build made from that clone.
- What were the used arguments? n/a — this breaks before CCExtractor is built.
# Video links
Not applicable; no media involved.
# Additional information
## Summary
The repo has **no `.gitattributes`**. Git for Windows defaults to `core.autocrlf=true`, so a clone made on Windows gets CRLF line endings in every text file — including the shebang of every POSIX shell script. The build documented in `docs/COMPILATION.MD` and the local-source Docker build in `docker/README.md` then fail before compiling anything.
`CONTRIBUTING.md` asks contributors to "Commit Unix line endings", but nothing in the repo enforces it.
## Reproduction
Clone with Git's default Windows setting and run the project's own pre-build step:
```bash
git -c core.autocrlf=true clone --depth 1 https://github.com/CCExtractor/ccextractor.git
cd ccextractor/linux
file pre-build.sh
# pre-build.sh: Bourne-Again shell script, ASCII text executable, with CRLF line terminators
head -1 pre-build.sh | cat -A
# #!/usr/bin/env bash^M$
```
Then run it under Linux (directly, in WSL, or in any container — this is what `docker/Dockerfile` does at step `RUN ./pre-build.sh`):
```
$ ./pre-build.sh
/usr/bin/env: 'bash\r': No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines
exit=127
```
Normalising just that one file to LF makes it exit 0, so the line endings are the whole cause.
I hit this myself: `docker build --build-arg USE_LOCAL_SOURCE=1 -f docker/Dockerfile .` on a Windows checkout fails at
```
ERROR: process "/bin/sh -c ./pre-build.sh" did not complete successfully: exit code: 127
```
## Affected files
16 tracked files carry a POSIX shebang and would be corrupted:
```
linux/autogen.sh linux/build linux/build_appimage.sh
linux/build_hardsubx linux/builddebug linux/cleanup
linux/module_generator linux/pre-build.sh mac/autogen.sh
mac/build.command mac/cleanup mac/gui/src/script.sh
mac/pre-build.sh package_creators/{arch,debian,rpm,tarball}.sh
snap/local/run-ccextractor.sh
```
## Suggested fix
Add a `.gitattributes` pinning those to `eol=lf` (and the Windows `.bat`/`.ps1` to `eol=crlf`).
Worth being explicit about one thing: **not** `* text=auto`. 978 tracked files are currently committed with CRLF, so a blanket rule would be a repo-wide renormalisation unrelated to this bug. A narrow rule changes no tracked file content — I verified that with `git add --renormalize`.
PR follows.
Contributor guide
Assessment
This issue has not been assessed yet.