Skip to content

Windows: one spelling per root module, and a battery that runs no shell (#809) - #2787

Merged
ehartford merged 2 commits into
fix-809from
fix-std-path-windows
Oct 28, 2026
Merged

ehartford merged 2 commits into
fix-809from
fix-std-path-windows

Conversation

@ehartford

@ehartford ehartford commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Commits (each message carries its root cause and evidence):

Mac battery GREEN on f8ee22e (379 s), run by the no-shell tools/battery.w with the tree's release compiler.

@ehartford
ehartford added this pull request to stack #2786 October 28, 2026 18:44
@ehartford ehartford changed the title fix std path windows sema, resolve: a std module's path is recognized with either separator (Windows checkout) Oct 28, 2026
@ehartford
ehartford force-pushed the fix-std-path-windows branch from 5da4174 to d47633f Compare October 28, 2026 19:01
@ehartford ehartford changed the title sema, resolve: a std module's path is recognized with either separator (Windows checkout) frontend: the root module's declarations carry the path its module was registered under (#809) Oct 28, 2026
Eric Hartford added 2 commits October 28, 2026 15:24
…s registered under (#809)

On win10, `tools\battery.w` could not run from the checkout:
"'spawn_os' requires an explicit import (§18.1); add: use std.thread.spawn_os"
under `use std.thread`. Not Windows-specific: on the Mac, `with check
sub/./prog.w` and `sub//prog.w` fail the same way; `sub/prog.w` passes.

Root cause (lldb on the installed compiler, `with check out/./th.w`):
Sema.update_module_context (SemaCheck.w:2511) sets current_module_path
from decl_source_paths, which compile_source seeded with the command
line's spelling (`out/./th.w`, Frontend.w seed_decl_source_paths /
append_decl_source_paths). Resolve registers the same module under
resolve_normalize_path (Resolve.w:315-327, `out/th.w`), so every lookup
keyed by the current module path (module_index_by_path, the import walk)
missed and the root module had no imports. On Windows the normalizer
turns `\` into `/`, so any backslash spelling hit it.

The root's declarations now carry resolve_normalize_path(name), the
module's one spelling; diagnostics keep the spelling the user gave.

`with analyze <file> 'explain:visible:<name>'` reported verdict 1 for
the failing spelling: it walks from the registered (normalized) root,
not from the path the checker used, so it was silent about this bug.
With one spelling the two agree.

Evidence: test/behavior/behav_809_root_path_spelling_keeps_imports.w
checks one program through three spellings; it fails on the installed
compiler (`spawn_os requires an explicit import` for `/./` and `//`).
…ss_alive and current_dir

Ruling (Eric, 2026-10-28): the build depends on no Unix or Windows
command. tools/battery.w ran every step through `sh -c` (shell syntax,
`$PWD`, redirections, `rm -rf`, `kill -0`) and wrapped the build in
/usr/bin/caffeinate; on Windows there is no sh, and the seed it looked
for was `src/main` where #2759 installs `src/main.exe`.

- Every step is an argument vector (run_to_files); `git` is invoked the
  same way. The build's stdout and stderr land in the step's log (stderr
  appended after the run; the live RED poll reads both while it runs).
- WITH (the pinned seed, absolute), WITH_DRIVER_SHA256 and
  WITH_SOURCES_COMMIT are set in the process environment the children
  inherit, instead of a shell prefix.
- `rm -rf` is remove_tree; the slot owner's liveness is
  std.process.process_alive (the runtime's with_process_alive, kill(pid,
  0) or OpenProcess); the working directory is std.os.current_dir (the
  runtime's with_current_dir over rt_getcwd, beside with_process_alive in
  rt_core: std.os importing rt.platform for it exposed the wasm runtime's
  names to the c_algorithms bundle), not $PWD, which cmd does not set.
- The seed is src/main.exe on Windows.
- caffeinate is gone: holding the machine awake and the display lit is
  the caller's (a host command either way).

Until a seed carries process_alive and current_dir, run it with the
tree's release compiler: `out/release/bin/with run tools/battery.w`.
@ehartford
ehartford force-pushed the fix-std-path-windows branch from d47633f to f8ee22e Compare October 28, 2026 19:32
@ehartford ehartford changed the title frontend: the root module's declarations carry the path its module was registered under (#809) Windows: one spelling per root module, and a battery that runs no shell (#809) Oct 28, 2026
@ehartford

Copy link
Copy Markdown
Contributor Author

Seed-driven Mac battery GREEN on the stack top f8ee22e (379 s, run by this stack's no-shell tools/battery.w with the tree's release compiler). The first full Windows battery on win10 (same top, 696 s) ran end to end and is RED on targets outside #809's list; inventory in the tracking issue filed with this merge.

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