Skip to content

#801: resolve embed_file on native Windows + un-skip its 3 tests - #813

Merged
ropoctl merged 3 commits into
mainfrom
windows-embed-path-801
Aug 17, 2026
Merged

ropoctl merged 3 commits into
mainfrom
windows-embed-path-801

Conversation

@ropoctl

@ropoctl ropoctl commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #812 (windows-regex-fnarg-abi-798).

What

  • Fix: tracked_dirname / tracked_normalize_path in src/compiler/TrackedInputs.w split path segments on / only. A native-Windows source path spelled with backslashes (with build src\app.w) then produces an empty dirname, so embed_file resolves its target against the process cwd instead of the source directory and fails "could not read". Both helpers are now separator-agnostic (/ and \), matching the sibling helpers tracked_path_is_absolute / tracked_path_has_parent_segment, which already treat \ as a separator on every platform.
  • Un-skip: const_str_embed_file_const, embed_file_computed_path, embed_file_relative_module were gated skip-windows on Windows: embed_file behavior tests fail #801. They build and print ok on native Windows.

Why the tests already pass (and the fix is still real)

The green battery feeds the compiler forward-slash-terminated source paths (rt_list_files joins with / via win_path_join), so the harness never hits the backslash regression — the three tests resolve correctly through it. The fix targets the remaining hand-typed-backslash CLI path, which a Windows dev will use; it is not exercised by a harness fixture but is verified manually on the VM.

Verification (Windows x86_64 VM, native)

  • 2×2 embed matrix (bare-filename + computed-subpath × forward-slash / backslash source path): before the fix, backslash cells fail embed_file: could not read; after, all four build and run ok.
  • Real test subcommand (build + run + stdout check) with battery-form relative paths: all three tests pass on both the current compiler and the Windows: embed_file behavior tests fail #801-fixed compiler, including the imported-module embed (relative_module).

Base automatically changed from windows-regex-fnarg-abi-798 to main August 17, 2026 06:37
@ropoctl
ropoctl force-pushed the windows-embed-path-801 branch from 06394bd to 10ac08f Compare August 17, 2026 06:37
…#801)

tracked_dirname and tracked_normalize_path split path segments on '/'
(byte 47) only. On native Windows a source path spelled with backslashes
(`with build src\app.w`) therefore yields an empty dirname, so a bare or
subdirectory embed_file target resolves against the process cwd instead
of the source file's directory and fails with "could not read".

Make both helpers separator-agnostic (split on '/' and '\'), matching the
sibling helpers tracked_path_is_absolute / tracked_path_has_parent_segment,
which already treat '\' as a separator on every platform. This is the
existing design decision made consistent, not a new one.

Verified on the Windows x86_64 VM with a 2x2 matrix (bare-filename and
computed-subpath embeds x forward-slash / backslash source paths): before,
backslash source paths fail "could not read"; after, all four cells build
and print "ok". The test harness always feeds forward-slash-terminated
paths (rt_list_files joins with '/'), so this specific regression is only
reachable from a hand-typed backslash CLI path and is verified manually
rather than by a harness fixture.
const_str_embed_file_const, embed_file_computed_path, and
embed_file_relative_module were gated skip-windows on #801. The green
battery feeds the compiler forward-slash-terminated source paths, which
embed_file already resolves correctly, so all three build and print "ok"
on native Windows.

Verified on the Windows x86_64 VM through the real `test` subcommand
(build + run + stdout check) with battery-form relative paths: all three
pass on both the current compiler and the #801-fixed compiler, including
the imported-module embed (relative_module).
… break asserts (#801)

embed_file embeds a fixture's bytes verbatim and the behavior tests assert
the result exactly (e.g. `DATA == "embedded const data\n"`). GitHub's
Windows runners set core.autocrlf=true, so a native checkout rewrites the
.txt fixtures to CRLF; embed_file then reads "...\r\n" and every assertion
fails at runtime (clean panic, exit 134) even though compilation succeeds.

Reproduced natively on the Windows VM: an LF copy of the fixture prints
"ok" (rc 0); a byte-identical CRLF copy panics 'assertion failed' (rc 134).

Pin the embed_file test fixtures to LF via .gitattributes so their bytes are
identical on every platform.
@ropoctl
ropoctl force-pushed the windows-embed-path-801 branch from 10ac08f to 9a92001 Compare August 17, 2026 06:39
@ropoctl
ropoctl merged commit 68d3397 into main Aug 17, 2026
3 checks passed
@ehartford
ehartford deleted the windows-embed-path-801 branch September 24, 2026 16:58
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