Skip to content

std.process.Child: fix double path normalization in spawnWindows #24562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

h57624paen
Copy link
Contributor

besides simply being redundant work, the now removed normalize call would cause spawn to errantly fail (BadPath) when passing a relative path which traversed 'above' the current working directory. This case is already handled by leaving normalization to the windows.wToPrefixedFileW call in windowsCreateProcessPathExt

@h57624paen h57624paen force-pushed the fix-win-spawn-double-normalize branch from be3c8b3 to 6019633 Compare July 25, 2025 05:27
h57624paen and others added 2 commits July 26, 2025 01:34
besides simply being redundant work, the now removed normalize call would cause
spawn to errantly fail (BadPath) when passing a relative path which traversed
'above' the current working directory. This case is already handled by leaving
normalization to the windows.wToPrefixedFileW call in
windowsCreateProcessPathExt
Also check that FileNotFound is consistently returned when the path is missing.

The new `run_relative` step will test spawning paths like:

    child_path: ../84385e7e669db0967d7a42765011dbe0/child
    missing_child_path: ../84385e7e669db0967d7a42765011dbe0/child_intentionally_missing
@h57624paen h57624paen force-pushed the fix-win-spawn-double-normalize branch from 6019633 to 0f41063 Compare July 26, 2025 05:38
Copy link
Collaborator

@squeek502 squeek502 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

For context to those reviewing, the normalizePath calls that are being removed were an artifact of the Windows ChildProcess rework in #13993 coming before #15768 which made the normalizePath calls obsolete.

This PR removes the obsolete normalization and adds tests to check that behavior didn't regress.

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.

2 participants