Commit Graph

1267 Commits

Author SHA1 Message Date
Shawn Yuan
aef23fdc2e Merge branch 'user/shawn/buildUX' of https://github.com/microsoft/WSL into user/shawn/buildUX 2026-04-10 12:12:47 +08:00
Shawn Yuan
61da5bc8ad resolve comments 2026-04-10 12:11:33 +08:00
Shawn Yuan
235327250b Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-10 11:52:06 +08:00
Shawn Yuan
628d3551b8 Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-10 10:59:29 +08:00
Shawn Yuan
678dcb36ab Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-10 10:57:41 +08:00
Shawn Yuan
a397487f62 Merge branch 'user/shawn/buildUX' of https://github.com/microsoft/WSL into user/shawn/buildUX 2026-04-10 10:44:02 +08:00
Shawn Yuan
4069041852 resolve comments 2026-04-10 09:22:25 +08:00
Shawn Yuan
4e18045cee update build message 2026-04-09 11:50:35 -07:00
Shawn Yuan
43eedbf001 resolve comments 2026-04-09 11:50:35 -07:00
Shawn Yuan
c3932b9035 update 2026-04-09 11:50:35 -07:00
Shawn Yuan
bd8f39c595 resolve comments 2026-04-09 11:50:35 -07:00
Shawn Yuan
1bdf948da0 change marker file output dir 2026-04-09 11:50:35 -07:00
Shawn Yuan
a4d4e54152 resolve comments 2026-04-09 11:50:35 -07:00
Shawn Yuan
1b9b788027 removed image saving from target file 2026-04-09 11:50:35 -07:00
Shawn Yuan
4e67f36610 Apply suggestion from @Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-09 11:50:35 -07:00
Shawn Yuan
c086f9a851 remove comments for wslc save 2026-04-09 11:50:35 -07:00
Shawn Yuan
b1121b183a merge cmake file 2026-04-09 11:50:35 -07:00
Shawn Yuan
80ae30bdaf add placeholder for wslc save step. 2026-04-09 11:50:35 -07:00
Shawn Yuan
2a6429ca50 resolve comments 2026-04-09 11:50:35 -07:00
Shawn Yuan
877c466369 update
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
2026-04-09 11:50:35 -07:00
Shawn Yuan
1e124d1c2d update
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
2026-04-09 11:50:35 -07:00
Shawn Yuan
a80b6c471f init
Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
2026-04-09 11:50:35 -07:00
Ben Hillis
ed62b7c8cb Fix tmpfs tests to use WSLC_TEST_METHOD macro (#40143)
Replace WSL2_TEST_ONLY() runtime skip macro (removed in #40129) with
WSLC_TEST_METHOD metadata macro in tmpfs tests added by #40128.

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-09 18:05:02 +00:00
Shawn Yuan
e7eb811ef7 update build message 2026-04-09 17:46:13 +08:00
Shawn Yuan
99ca823d0d resolve comments 2026-04-09 17:17:07 +08:00
Shawn Yuan
53c269b403 update 2026-04-09 14:23:06 +08:00
Shawn Yuan
c7edfb957e resolve comments 2026-04-09 14:11:20 +08:00
Shawn Yuan
96eca90bb8 change marker file output dir 2026-04-09 14:08:07 +08:00
Shawn Yuan
da0b8f58f2 resolve comments 2026-04-09 11:42:48 +08:00
Shawn Yuan
86e9ccec37 removed image saving from target file 2026-04-09 11:12:57 +08:00
Shawn Yuan
13251c754e Merge remote-tracking branch 'origin/feature/wsl-for-apps' into user/shawn/buildUX 2026-04-09 10:50:28 +08:00
Ben Hillis
9c4dba919f Refactor tests: use TAEF metadata for WSL version filtering (#40129)
Replace runtime WSL2_TEST_ONLY()/WSL1_TEST_ONLY() skip macros with
TAEF metadata-based test selection. Tests that don't apply to the
current WSL version are now excluded by /select: queries at selection
time rather than skipped at runtime, eliminating hundreds of 'skipped'
results from test output.

Changes:
- Add WSL2_TEST_METHOD, WSL1_TEST_METHOD, WSLC_TEST_METHOD macros
  in Common.h that tag tests with WSLVersion metadata property
- Convert ~430 test methods across 26 files to use new macros
- Update run-tests.ps1 to auto-add /select: version filter
- Update CloudTest XML configs with version selection queries
- Remove WSL2_TEST_ONLY() from composite macros in NetworkTests.cpp
- Update test README with new macro documentation

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-08 17:45:18 -07:00
David Bennett
01706c9cdc CLI: Fix forwarded args beginning with '-' from being a parser error (#40131) 2026-04-08 11:03:09 -07:00
Blue
fcd425932b Fix race condition when building multiple IDL files (#40130)
* Fix race condition when building multiple IDL files

* Use the header as output

* Use a single target

* Use a separate command to set the stamp file

* Remove stamp file
2026-04-08 10:53:12 -07:00
Ben Hillis
c0dd0ce656 Add DCOM LaunchPermission for WSLCSessionFactory (#40134)
* Add DCOM LaunchPermission for WSLCSessionFactory

WSLCSessionFactory (wslcsession.exe) was registered without an AppId or
explicit DCOM LaunchPermission. When wslservice (SYSTEM) impersonates a
non-interactive caller such as Network Service and calls
CreateComServerAsUser to launch the per-user session factory, DCOM falls
back to machine-default launch permissions which do not include service
accounts. This causes E_ACCESSDENIED during session creation.

Add an AppId with the same LaunchPermission and AccessPermission SDDL
used by the other WSL COM servers (LxssUserSession, WSLCSessionManager,
WslDeviceHost), granting launch/activate rights to Authenticated Users
(AU), Principal Self (PS), and Local System (SY).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Extract DCOM permission blob into CMake variable

The same binary security descriptor was duplicated 8 times across 4 AppId
registrations. Extract it into a DCOM_PERMISSION CMake variable defined in
msipackage/CMakeLists.txt so future permission changes only need one edit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-08 06:30:45 -07:00
Blue
ff10ed8a94 Fail the session creation if the virtionet interface can't be initialized (#40124)
* Fail the session creation if the virtionet interface can't be initialized

* Apply PR feedback
2026-04-07 17:43:15 -07:00
AmirMS
2ffbe4826d [CLI] Initialize tmpfs support (#40128)
* Init tmpfs support

* Resolve copilot comment
2026-04-07 14:41:59 -07:00
Craig Loewen
e5d589d546 Update WSLCCreateSession event to critical. (#40065)
* Updated event to critical

* Updated event

* Apply suggestion from @craigloewen-msft

* Revert "Apply suggestion from @craigloewen-msft"

This reverts commit 7800a35587.
2026-04-07 16:33:43 -04:00
Pooja Trivedi
76606190d8 Add E2E test for --version flag (#40125)
* Add E2E test for --version flag

Ensures both entry points (the 'version' subcommand and the '--version' flag)
are covered by E2E tests, preventing the two paths from drifting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix newline

---------

Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-07 13:57:28 -04:00
Pooja Trivedi
715ce52834 [WSLC] Add 'wslc version' subcommand (#14547)
* [WSLC] Add 'wslc version' subcommand

Adds a 'version' subcommand to the WSLC CLI as an alternative to the
existing '--version' flag, following the subcommand pattern used by
other WSLC commands. Includes unit tests for command structure and
command-line parsing.

Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-Authored-By: Claude Sonnet 4.6

* [WSLC] Fix E2E help/invalid-command tests after version subcommand addition

Update expected help output in WSLCE2EGlobalTests to include the newly
added 'version' subcommand, fixing WSLCE2E_HelpCommand and
WSLCE2E_InvalidCommand_DisplaysErrorMessage test failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* [WSLC] Add E2E version command test and strengthen unit test

- Add WSLCE2E_VersionCommand E2E test in WSLCE2EGlobalTests verifying
  stdout, empty stderr, and exit code for 'wslc version'
- Add assertion to VersionCommand_HasNoArguments unit test to verify
  only the auto-added --help argument is present

Authored-By: Pooja Trivedi <trivedipooja@microsoft.com>
Co-Authored-By: Claude Sonnet 4.6

* Mark 'context' as UNREFERENCED_PARAMETER in
VersionCommand::ExecuteInternal to avoid build issues

* Address PR feedback on wslc version command

- Use Localization::WSLCCLI_VersionDesc/LongDesc instead of hard-coded strings; add entries to en-US Resources.resw
- Centralize version printing in VersionCommand::PrintVersion(); reuse from RootCommand --version flag
- Drop 'v' prefix from version output per OneBlue's feedback
- Add 'version' entry to E2E GetAvailableCommands() to fix WSLCE2E_HelpCommand and WSLCE2E_InvalidCommand_DisplaysErrorMessage

Co-Authored-By: Pooja Trivedi

* Fix build: add missing using namespace wsl::shared

Localization::WSLCCLI_VersionDesc() and WSLCCLI_VersionLongDesc() live in
wsl::shared::Localization. Without this using directive the compiler cannot
resolve the unqualified Localization:: references in VersionCommand.cpp.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-06 22:58:59 -04:00
Ben Hillis
c223800f46 wslc: implement dns tunneling for virtio proxy networking mode (#40104)
* wslc: implement dns tunneling for virtio proxy networking mode

This change implements dnstunneling for the virtio proxy networking mode. For now, this implementation uses the same socket-based approach, but in the fututure this will be moved over to the built-in dns support that is part of the wsldevicehost dll.

* wslc: enable DNS tunneling by default for virtio proxy

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Remove unused DNS test helpers

VerifyDnsResolutionDig and VerifyDnsResolutionRecordTypes are dead
code — VerifyDnsQueries is the superset that covers all record types
and TCP/UDP modes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-07 01:40:04 +00:00
Blue
3f7cb6bc7a Add logic to reject invalid flags (#40100)
* Add logic to reject invalid flags

* Simplify tests

* Use macros

* Format

* Format
2026-04-06 18:36:17 -07:00
Blue
c4d7711d19 Correctly handle empty arguments & entrypoint when launching containers (#40122)
* Correctly handle empty arguments & entrypoint when launching containers

* Apply PR feedback
2026-04-06 17:44:48 -07:00
Ben Hillis
dbfe96f54a Make VMPortMapping::Unmap idempotent (#40091)
* Make VMPortMapping::Unmap idempotent

Null out Vm after unmapping so a second call is a no-op. This prevents
double-unmap errors when ReleaseRuntimeResources is called from both
OnEvent(Stop) and a concurrent Delete(Force) path.

* Clear Vm before re-throwing on UnmapPort failure

Use a scope_exit to null Vm so that Unmap() is truly idempotent
even when UnmapPort() throws. Previously Vm stayed non-null on
the failure path, causing subsequent Unmap() calls to retry and
throw again.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-06 15:18:44 -07:00
Blue
9d39805c4d Implement wslc session enter (#40088)
* Save state

* Save state

* Save state

* Cleanup

* Prepare for PR

* Cleanup

* Validate flags

* Apply PR suggestions

* Add comment

* Remove include

* Cleanup diff

* Format

* Format

* Restore session flags
2026-04-06 11:51:09 -07:00
Pooja Trivedi
2d8c8cf295 [WSLC] Add --workdir / -w option to 'wslc exec' (#40041)
* [WSLC] Add --workdir / -w option to 'wslc exec'

Adds a --workdir (-w) argument to the exec command that sets the working
directory inside the container for the executed process. Wires the value
through ContainerOptions into WSLAProcessLauncher::SetWorkingDirectory.

Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-Authored-By: Claude Sonnet 4.6

* Update test/windows/wslc/CommandLineTestCases.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update test/windows/wslc/CommandLineTestCases.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix clang formatting issues

* Update test/windows/wslc/WSLCCLIExecutionUnitTests.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add E2E tests for wslc container exec, including --workdir option

- Port existing exec E2E tests from feature branch
- Add WSLCE2E_Container_Exec_WorkDir and WSLCE2E_Container_Exec_WorkDir_ShortAlias tests
- Update help message in GetAvailableOptions to include -w,--workdir

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix clang formatting in WSLCE2EContainerExecTests.cpp

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Validate --workdir is non-empty; add unit and parse test cases

- Reject empty or whitespace-only --workdir in Argument::Validate
- Add ExecCommand_ParseWorkDirEmptyValue_ThrowsArgumentException unit test
- Add empty-workdir failing case to CommandLineTestCases.h

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix clang formatting in CommandLineTestCases.h

Co-Authored-By: Claude Sonnet 4.6

* Trim exec E2E tests to --workdir coverage only

Remove tests that duplicate existing coverage in WSLCE2EContainerCreateTests.cpp.
Keep only the help message test (validates --workdir appears in output) and the
two workdir-specific E2E tests.

Co-Authored-By: Claude Sonnet 4.6

* Missed change from merge conflict resolution

* Fix --workdir whitespace validation to use std::iswspace for full Unicode coverage

Agent-Logs-Url: https://github.com/microsoft/WSL/sessions/b21d1a57-bb3f-4a12-84cf-8e414a453890

Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>

* Use lambda with wint_t cast in iswspace call to avoid potential UB

Agent-Logs-Url: https://github.com/microsoft/WSL/sessions/b21d1a57-bb3f-4a12-84cf-8e414a453890

Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>

* Missed change from merge conflict resolution

* Address Copilot PR feedback

- Revert Version ArgType alias from NO_ALIAS back to L"v" to preserve existing -v short option
- Restore WSLCE2EContainerExecTests.cpp lost in merge conflict resolution

Co-Authored-By: Pooja Trivedi

* Update src/windows/wslc/services/ContainerService.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix ParserTest_StateMachine_PositionalForward: replace -v with -h in flag parse tests

The -v short alias was removed from --verbose (changed to NO_ALIAS) to
resolve a triple alias conflict with --version and --volume. The parser
test cases in the Run argument set still used -v expecting it to resolve
to --verbose, but since neither Version nor Volume are in the Run set,
-v became unresolvable and caused unexpected parse failures.

Replace -v with -h (help flag) in the flag parse test cases to preserve
the same combined-flag parsing coverage with a valid short alias.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix E2E exec help test: add --user option after base branch merge

After merging feature/wsl-for-apps, the --user argument is now active
in ContainerExecCommand (from PR #40101). Update the expected exec help
output to include -u,--user.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Pooja Trivedi <trivedipooja@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ptrivedi <1638019+ptrivedi@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-06 14:04:38 -04:00
Ben Hillis
a8ee0432df Add response size limit to Docker HTTP client (#40097)
SendRequestAndReadResponse accumulates the entire response body into
a std::string with no size limit. While all current callers expect
small JSON metadata responses, a pathological or malformed response
could cause unbounded memory growth.

Add a 64 MB limit to prevent OOM. This is generous for JSON metadata
(list/inspect/create responses are typically <1 MB) while still
catching runaway responses early.

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
2026-04-04 16:13:14 +00:00
Blue
e146f6b027 Add logic to clean up images created during the tests (#40078)
* Save state

* Format

* Log failures

* Format
2026-04-03 18:40:37 -07:00
AmirMS
c423fa80df Initialize user option support and added E2E tests (#40101)
* Init user option support

* Init e2e test

* Added more E2E Tests

* Fix test

* Clang format

* Fix test

* Rename test to UnknownGroup_Fails to reflect actual failure mode

Agent-Logs-Url: https://github.com/microsoft/WSL/sessions/0e095692-5673-4e8f-ad7f-47deccb74ec9

Co-authored-by: AmelBawa-msft <104940545+AmelBawa-msft@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-04-03 17:04:06 -07:00
Blue
619fe1f820 Localization change from build: 143644543 (#40098)
Co-authored-by: WSL localization <noreply@microsoft.com>
2026-04-03 13:52:35 -07:00