CLI: Relative volume path support, improved error detection and messaging, more volume tests#40193
Open
dkbennett wants to merge 5 commits intofeature/wsl-for-appsfrom
Open
CLI: Relative volume path support, improved error detection and messaging, more volume tests#40193dkbennett wants to merge 5 commits intofeature/wsl-for-appsfrom
dkbennett wants to merge 5 commits intofeature/wsl-for-appsfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds CLI-side validation and relative host-path handling for --volume specs to avoid opaque E_FAIL errors, while updating tests and localized error messages accordingly.
Changes:
- Add relative host-path resolution for volume mounts and validate path/name inputs.
- Localize volume-spec error messages and improve error detection (empty container path, invalid Windows host path).
- Expand/adjust unit + E2E tests to cover the new parsing rules and messaging.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp | Adds E2E coverage for relative host-path volumes; updates expected stderr strings for invalid specs. |
| test/windows/wslc/WSLCVolumeMountUnitTests.cpp | Updates parse tests for relative paths and adds named-volume name validation tests. |
| test/windows/wslc/CommandLineTestCases.h | Updates CLI parsing testcases to use ./ volume host syntax. |
| src/windows/wslc/services/ContainerModel.h | Exposes VolumeMount::IsValidNamedVolumeName. |
| src/windows/wslc/services/ContainerModel.cpp | Implements named-volume name validation, adds relative path resolution + improved/localized validation errors. |
| localization/strings/en-US/Resources.resw | Adds localized strings for the new volume validation messages/usage text. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
OneBlue
reviewed
Apr 15, 2026
kevpar
reviewed
Apr 15, 2026
…om/microsoft/WSL into user/dkbennett/relativevolumepaths
| // This can be either an existing named volume or a new named volume that will be created. | ||
| if (VolumeMount::IsValidNamedVolumeName(rawHostPath)) | ||
| { | ||
| // TODO: Handle named volume reference in the request. |
There was a problem hiding this comment.
Thanks for adding this block. I will investigate what is needed to wire this up
| // Returns true if the given string is a valid Docker named volume name. | ||
| // Based on Docker's named volume validation: ^[a-zA-Z0-9][a-zA-Z0-9_.-]{1,}$ | ||
| // Source: https://github.com/moby/moby/blob/master/volume/validate.go | ||
| bool VolumeMount::IsValidNamedVolumeName(const std::wstring& name) |
There was a problem hiding this comment.
Thanks for adding this validation and the original reference!
OneBlue
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
This primarily adds support for relative volume paths in volume specifications.
It also adds:
This also removes all known cases of "Unspecified error. E_FAIL" messages that could occur with volume specifier strings due to invalid input being passed into the service. The CLI now checks for the obvious error conditions and provides a better user message in the case of bad input.
Tests are also updated to reflect any changes in messaging and behavior as a result of the new empty checks and relative path.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Currently named volumes can be detected but are ignored and treated as relative paths until named volume support is completed.
Relative paths function with forward and backward slashes and validates against the Windows API for valid path. The paths provided for the host are not required to exist on disk, but they are required to be a valid resolved name.
Validation Steps Performed