Skip to content

fix(runtime): write the module index with unix line endings - #12

Merged
Tratosca merged 1 commit into
mainfrom
fix/module-index-crlf
Aug 14, 2026
Merged

fix(runtime): write the module index with unix line endings#12
Tratosca merged 1 commit into
mainfrom
fix/module-index-crlf

Conversation

@Tratosca

Copy link
Copy Markdown
Owner

An autoexec.bin built on Windows stops with one FAILED: unsafe runtime module directory per selected module, then STOP: one or more runtime modules violate their contract. Nothing is applied, on every build, for every user on that platform.

Refs #11.

Cause

The index naming the modules to load is written from Python, which translates each newline to the platform's own unless told otherwise. On Windows that appends a carriage return to every line.

mod/autoexec.sh reads the file with IFS= read -r, which strips the LF and keeps the CR, so the directory name reaching the check ends in a character it rejects — correctly, since that directory does not exist. Passing newline="" writes the LFs untranslated.

The bracketed names in the reported log break across two lines for the same reason: what sits before the ] is a CR.

Why the tests missed it

Two assertions normalised CRLF out of the built image before searching it — which is exactly what a build carrying this fault produces — so they passed on Windows rather than failing. They now assert the bytes as the player reads them.

The new regression test also asserts the newline argument in the source. Linux and macOS never perform the translation, so the built image cannot exhibit the fault there, and the unit tests only ever run on ubuntu-24.04 in CI; a byte-level assertion alone would guard nothing.

Scope

Affects 0.5.0 and 0.5.1. The module index arrived in 031e6ca, so 0.4.0 predates it and is unaffected, which matches the report. Builds made on Linux and macOS were never affected.

Checks

make test (134 tests) and make preflight pass locally.

Note

Windows-built artifacts are not covered by CI: the packaging matrix builds on Windows but does not run test_mod_generator there. Worth a separate look.

An autoexec.bin built on Windows stopped with one "unsafe runtime module
directory" per selected module, then "STOP: one or more runtime modules violate
their contract". Nothing was applied, on every build, for every user on that
platform.

The index naming the modules to load is written from Python, which translates
each newline to the platform's own unless it is told not to. On Windows that
put a carriage return at the end of every line. The orchestrator reads the file
with `IFS= read -r`, which strips the LF and keeps the CR, so the directory
name it validates ends in a character the name check rejects - correctly, since
that directory does not exist. Passing newline="" writes the LFs untranslated.

Two tests normalised CRLF out of the built image before searching it, which is
what a build carrying this fault produces, so they passed on Windows instead of
failing. They now assert the bytes as the player reads them.

The regression test also asserts the newline argument in the source: Linux and
macOS never perform the translation, so the built image cannot show the fault
there, and the unit tests only ever run on ubuntu in CI.

Affects 0.5.0 and 0.5.1. Refs #11.
@Tratosca
Tratosca merged commit 73bf2ce into main Aug 14, 2026
8 checks passed
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