aboutcode-org / aboutcode-org/vulnerablecode

Windows developers unable to run docker-compose due to line ending issues

未關閉
#2,100 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
702
分支
328
平均合併
3 天 8 小時
30 天內合併 PR
3

描述

## 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:
```bash
docker compose exec vulnerablecode ./manage.py import
docker compose exec vulnerablecode ./manage.py improve --all
```

## Root Cause

The issue occurs because:

1. Git on Windows by default converts line endings from LF (Unix) to CRLF (Windows) when cloning repositories
2. The repository lacks a `.gitattributes` file to enforce consistent line endings
3. 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
4. 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:**
1. Clone the repository on Windows: `git clone https://github.com/aboutcode-org/vulnerablecode.git`
2. Navigate to the directory: `cd vulnerablecode`
3. Run: `docker compose up -d`
4. Check service status: `docker compose ps`
5. Observe that the `vulnerablecode` service has exited
6. 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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。