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"

Abierto
#2,345 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C
Estrellas
903
Forks
589
Merge medio
3 d 2 h
PR fusionados (30 d)
10

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.