Skip to content

Conversation

@Cooksey99
Copy link
Contributor

Summary

In response to Issue #25703

Fixes a panic in std.fs.path.resolveWindows when processing relative drive paths.

Issue

When calling resolveWindows(&[_][]const u8{ "c:foo", "bar" }), the function would panic with "index out of bounds: index 0, len 0".

Root Causes

  1. Index out of bounds: compareDiskDesignators tried to access disk_designator[0] without checking if the string was empty
  2. Missing disk designator: Relative drive paths didn't write the drive letter to output (produced foo\bar instead of C:foo\bar)
  3. Incorrect separator logic: Added \ after drive letter for relative paths (would produce C:\foo instead of C:foo)

Testing

zig build test-std -Dtest-filter="resolveWindows"

@Cooksey99 Cooksey99 marked this pull request as draft October 26, 2025 23:10
@Cooksey99 Cooksey99 marked this pull request as ready for review October 26, 2025 23:31
@alexrp alexrp requested a review from squeek502 October 27, 2025 01:54
@alexrp
Copy link
Member

alexrp commented Oct 27, 2025

Needs a rebase due to merge conflicts.

@squeek502
Copy link
Member

Thanks for working on this!

I'm in the middle of a larger reworking of the Windows std.fs.path stuff, so I'll revisit this when I'm further along and see how it fits in.

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.

3 participants