Description
Windows developers encounter a critical failure when attempting to run VulnerableCode using Docker Compose. The main vulnerablecode service fails to start with the following error:
env: use -[v]S to pass options in shebang line
This prevents Windows developers from setting up a local development environment and running essential commands like:
docker compose exec vulnerablecode ./manage.py import <importer>
docker compose exec vulnerablecode ./manage.py improve --all
Root Cause
The issue occurs because:
- Git on Windows by default converts line endings from LF (Unix) to CRLF (Windows) when cloning repositories
- The repository lacks a
.gitattributes file to enforce consistent line endings
- When Docker runs the Linux container, the shebang line (
#!/usr/bin/env python) in manage.py fails because it includes the Windows carriage return (\r) character
- This causes the container to exit immediately with code 1
Steps to Reproduce
Environment:
- OS: Windows 10/11
- Docker Desktop for Windows (with WSL2 backend)
- Git for Windows (default settings)
Steps:
- Clone the repository on Windows:
git clone https://github.com/aboutcode-org/vulnerablecode.git
- Navigate to the directory:
cd vulnerablecode
- Run:
docker compose up -d
- Check service status:
docker compose ps
- Observe that the
vulnerablecode service has exited
- Check logs:
docker compose logs vulnerablecode
Expected behavior: All services should start successfully and remain running.
Actual behavior: The vulnerablecode service exits with error "env: use -[v]S to pass options in shebang line"
Impact
This issue affects:
- New contributors trying to set up their development environment on Windows
- Windows developers participating in GSoC or other contribution programs
- Anyone attempting to test or deploy VulnerableCode on Windows with Docker
Additional Notes
This is a common issue in cross-platform development and is considered a best practice to include a .gitattributes file in repositories that are used across different operating systems.
I would like to contribute
I'd be happy to submit a PR to add the .gitattributes file and update the documentation if needed. Please let me know if this approach looks good to you.
Description
Windows developers encounter a critical failure when attempting to run VulnerableCode using Docker Compose. The main
vulnerablecodeservice fails to start with the following error:This prevents Windows developers from setting up a local development environment and running essential commands like:
Root Cause
The issue occurs because:
.gitattributesfile to enforce consistent line endings#!/usr/bin/env python) inmanage.pyfails because it includes the Windows carriage return (\r) characterSteps to Reproduce
Environment:
Steps:
git clone https://github.com/aboutcode-org/vulnerablecode.gitcd vulnerablecodedocker compose up -ddocker compose psvulnerablecodeservice has exiteddocker compose logs vulnerablecodeExpected behavior: All services should start successfully and remain running.
Actual behavior: The
vulnerablecodeservice exits with error "env: use -[v]S to pass options in shebang line"Impact
This issue affects:
Additional Notes
This is a common issue in cross-platform development and is considered a best practice to include a
.gitattributesfile in repositories that are used across different operating systems.I would like to contribute
I'd be happy to submit a PR to add the
.gitattributesfile and update the documentation if needed. Please let me know if this approach looks good to you.