Skip to content

Fix Windows WIT loading and generator paths - #429

Open
kjanat wants to merge 5 commits into
bytecodealliance:mainfrom
kjanat:fix/wit-loader-paths
Open

kjanat wants to merge 5 commits into
bytecodealliance:mainfrom
kjanat:fix/wit-loader-paths

Conversation

@kjanat

@kjanat kjanat commented Oct 22, 2026 •

Copy link
Copy Markdown

LoadWIT rejects valid Windows paths when native separators in WASI preopen names do not match guest paths. Successful loads also leave the embedded runtime open, leaking directory handles.

Use / for guest arguments and preopen names, native paths for host mounts, and close the runtime after each load. Stop generator module lookup at drive roots and construct generated fixture paths with filesystem-relative paths.

Make tests work with Windows directory permissions and with checkout and temporary directories on different drives. Keep WIT fixtures LF-only and use explicit cleanup where TinyGo cannot recursively remove directories. Add Windows to the existing Go CI matrix.

Verification: full Windows go test -count=1 ./... ./cm/...; full WIT suite with checkout on V: and temp files on C:; generator and directory-helper packages under TinyGo WASI Preview 1 and 2.

Normalize guest paths so Windows separators do not break WIT loading.
Close the embedded runtime after each load to release directory handles.
Compare each directory with its parent to detect filesystem roots.
The slash-only check looped forever at Windows drive roots when
no go.mod existed. Keep nested package suffixes while ascending.
Build fixture paths with filepath.Rel and filepath.Join. Test
Windows directory creation permissions with an ACL and compare
created permissions with a control directory on the same filesystem.
Remove empty test directories before TinyGo cleanup.
Keep WIT path fixtures on the checkout volume and WIT goldens
on LF endings. Remove owned temporary files explicitly for TinyGo.
Run the existing Go version matrix on Windows as well as Linux.
@kjanat kjanat changed the title wit: fix guest paths and close loader runtimes Fix Windows WIT loading and generator paths Oct 24, 2026

This branch has not been deployed

No deployments
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