Skip to content

#802: fix p7 build-harness cwd, un-skip overflow_modes on Windows - #814

Merged
ropoctl merged 3 commits into
mainfrom
windows-unskip-802
Aug 17, 2026
Merged

ropoctl merged 3 commits into
mainfrom
windows-unskip-802

Conversation

@ropoctl

@ropoctl ropoctl commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

Bottom of the Windows un-skip stack (base main).

Fixes the p7 build-harness so a child with build invoked through
test/behavior/lib/pre_d_build_runner.w resolves its working directory
correctly on native Windows:

  • resolve the harness cwd via rt_getcwd and append the .exe suffix to
    the spawned compiler path (Windows has no implicit executable resolution)
  • fix p7_cwd returning a str over a freed stack buffer (the exit-134
    interior-NUL cluster) by taking ownership of the path bytes

With the harness correct, un-skips behav_project_overflow_modes (its
[build] overflow=wrap/saturate case now evaluates correctly on Windows).

The other two #802 tests — behav_build_w_basic_invocation and
behav_cli_test_command_args — stay skipped: their build/test child spawn
still fails on Windows even with the cwd fix (tracked in #72).

Base automatically changed from windows-embed-path-801 to main August 17, 2026 16:38
@ropoctl
ropoctl force-pushed the windows-unskip-802 branch from 8a6a378 to bb21e9b Compare August 17, 2026 16:38
…ix (#800)

The pre-D p7 build harness located the repo root with `env("PWD")` and
built the child-compiler path without a `.exe` suffix. Both fail on native
Windows: cmd.exe never sets PWD, a bash shell sets it to a POSIX `/d/...`
path Win32 rejects, and every `file_exists` probe missed the real
`with-stage2.exe`/`with.exe` so the harness fell through to a nonexistent
candidate and silently failed to spawn the compiler.

Resolve the working directory with `rt_getcwd` (a native path, correct on
cmd.exe and under bash alike) and append `.exe` on Windows. On Linux/macOS
getcwd equals the former PWD and the suffix is empty, so behavior is
unchanged there.
…uster)

p7_cwd returned with_str_from_cstr(&buf) over a local [4096]u8 stack
buffer. with_str_from_cstr forwards to make_str, which wraps the pointer
without copying, so the returned str aliases the stack frame that dies on
return. p7_repo_root hands that dangling str to p7_join/p7_abs, which read
its bytes to build case_dir, the compiler path, and the capture paths.

On Linux/darwin the reused frame happened to still hold the path bytes at
read time, so the tests passed. On Windows the native-bootstrapped stage2
lays the frame out differently and clobbers buf between return and read,
corrupting case_dir into a path with an interior NUL. That path is then
converted to a C string for a file/spawn API and panics 'str to C string
conversion: interior NUL byte' -> abort -> exit 134 with empty
(block-buffered) stdout, the whole p7 cluster's signature.

Copy the string off the stack with .to_owned() while buf is still alive.
…s fixed (#802)

behav_project_overflow_modes drives a child `with build` through the p7
pre_d_build_runner harness. With the rt_getcwd/.exe-suffix and p7_cwd
dangling-str fixes in place, the [build] overflow=wrap/saturate case
evaluates correctly on native Windows, so the #802 skip no longer applies.

The remaining #802 skips (behav_build_w_basic_invocation,
behav_cli_test_command_args) stay gated — those p7 build/test child spawns
still fail on Windows even with the cwd fix; tracked in #72.
@ropoctl
ropoctl force-pushed the windows-unskip-802 branch from bb21e9b to 61c1778 Compare August 17, 2026 18:54
@ropoctl ropoctl changed the title #802: un-skip 4 stale Windows core-language behavior tests #802: fix p7 build-harness cwd, un-skip overflow_modes on Windows Aug 17, 2026
@ropoctl
ropoctl merged commit ec55728 into main Aug 17, 2026
3 checks passed
@ehartford
ehartford deleted the windows-unskip-802 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