Skip to content

fix(install): normalize a CRLF .env before reading it - #728

Open
BaaRai wants to merge 1 commit into
mainfrom
fix/install-env-crlf
Open

BaaRai wants to merge 1 commit into
mainfrom
fix/install-env-crlf

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Summary

Found by the isolated fresh-install test, not by reading the script.

A Windows checkout (core.autocrlf=true) materializes .env.example as CRLF, so every line in the generated .env ends with \r. ensure_runner_token used grep -q '^ARTEX_RUNNER_TOKEN=.', where . matches the \r: the empty token line looked set, the token was never generated, and docker compose failed before the build with:

error while interpolating services.artex.environment.ARTEX_RUNNER_TOKEN:
required variable ARTEX_RUNNER_TOKEN is missing a value

The same trailing \r also reaches PostgreSQL as part of POSTGRES_PASSWORD.

Fix

  • install.sh and update.sh convert .env to LF before reading it (normalize_env), both for an existing file and right after the .env.example copy.
  • The token check now requires ^ARTEX_RUNNER_TOKEN=[^[:space:]], so an empty value is never treated as set even if a stray terminator remains.

Verification

  • bash -n install.sh update.sh: PASS.
  • Function-level test with a CRLF .env (POSTGRES_PASSWORD=testpw123, empty token): after the fix the file is LF, the token is generated, the password is preserved. Before the fix the token stayed empty and compose rejected the interpolation.
  • End-to-end: the isolated install (separate compose project, ports 18787/11788) reproduces the failure with the copied CRLF .env and installs cleanly after the conversion.

No Go code, no schema, no config format change.

A Windows checkout (core.autocrlf=true) materializes .env.example as CRLF,
so every value carries a trailing CR. ensure_runner_token matched the empty
ARTEX_RUNNER_TOKEN line through '.', left it empty, and compose failed the
required-variable interpolation before the build. Both install.sh and
update.sh now convert .env to LF first and require a non-whitespace value
before treating the token as set.

Found by the isolated fresh-install test: the copied .env reproduced the
failure before the fix and installs cleanly after it.
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