Skip to content

Conversation

@w3spi5
Copy link

@w3spi5 w3spi5 commented Jan 25, 2026

Problem

The installation script silently exits after displaying "Configuration:" when run on Windows with Git Bash / MINGW. No error message is shown, making debugging very difficult.

Root Causes

  1. CRLF line endings: Git on Windows converts files to CRLF by default, which breaks bash scripts
  2. Bash arithmetic exit codes: Expressions like ((count++)) return exit code 1 when the variable is 0 (because 0 is "false" in bash). Combined with set -e, this silently terminates the script

Solution

1. Auto-fix CRLF on Windows

Added detection and automatic conversion of CRLF to LF when running on MINGW/MSYS. The script converts all .sh and .yml files, then restarts itself.

2. Retry mechanism

If the script fails for any reason, it automatically retries without strict mode (set -e), allowing it to complete and show any errors.

3. Safe arithmetic expressions

Added || true to all ((var++)) expressions to prevent them from triggering set -e when the variable is 0.

4. .gitattributes

Added .gitattributes to enforce LF line endings for future clones.

Files Changed

  • scripts/project-install.sh - Added CRLF fix, retry mechanism, and safe arithmetic
  • .gitattributes - New file to enforce LF line endings

Testing

Tested on Windows 11 with Git Bash (MINGW64). Script now completes successfully on first run.

@w3spi5
Copy link
Author

w3spi5 commented Jan 25, 2026

Hi @briancasel,

I noticed PR #317 by @Perlover addresses the same arithmetic exit code issue. Their approach uses pre-increment ((++var)) instead of my ((var++)) || true — both work, but theirs is cleaner.

However, my PR includes additional fixes that #317 doesn't cover:

  1. Auto-fix CRLF on Windows — Detects and converts CRLF to LF automatically when running on Git Bash/MINGW, then restarts the script
  2. Retry mechanism — If the script still fails for any reason, it retries without set -e to allow completion
  3. .gitattributes — Prevents CRLF issues for future clones

These additions specifically address Windows compatibility issues that caused the script to fail silently (see discussion #311).

Suggestion: You could merge #317 first (simpler fix), then cherry-pick my CRLF/retry additions. Or I can update my PR to use ((++var)) instead of || true if you prefer a single merged solution.

Let me know what works best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant