Repository navigation
Fix VHD operations on older Windows versions - #42041
Merged
Ben Hillis (benhillis) merged 1 commit intoOct 23, 2026
Merged
Conversation
Only request encrypted-file support on Windows build 22631 and later, and skip CompactEncrypted on older builds. Fixes the older-Windows regression introduced by #42008. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7aea2e49-4dd6-4657-bc07-495d2cfe7cae
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
No blocking code defects were identified, but Windows-matrix runtime validation remains pending for the affected VHD operations.
No open issues 🎉
What changed in this PR
This PR addresses the older-Windows VHD regression introduced by #42008 while retaining encrypted-VHD support on build 22631 and later.
Changes:
- Gate
OPEN_VIRTUAL_DISK_FLAG_SUPPORT_ENCRYPTED_FILESonNickel_23H2; older builds useOPEN_VIRTUAL_DISK_FLAG_NONE. - Apply the same minimum version to
CompactEncrypted, skipping before distribution creation.
| File | Description |
|---|---|
| test/windows/wsl/UnitTests.cpp | Skip encrypted-compaction testing below build 22631. |
| src/windows/common/WslCoreFilesystem.cpp | Select VHD open flags based on the Windows build. |
Review effort: Balanced
Daman Mulye (damanm24)
approved these changes
Oct 23, 2026
Blue (OneBlue)
approved these changes
Oct 23, 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
Fix the older-Windows regression introduced by #42008. Only pass
OPEN_VIRTUAL_DISK_FLAG_SUPPORT_ENCRYPTED_FILESon build 22631 (Nickel_23H2) and later, and apply the same minimum version toCompactEncrypted.cc Feng Wang (@chemwolf6922)
PR Checklist
Detailed Description of the Pull Request / Additional comments
Windows 10 22H2 and Windows Server 2022 reject the encrypted-file support flag with
ERROR_INVALID_PARAMETER, even when opening an unencrypted VHD. This breaksTestExistingSwapVhd,Resize,Compact, andCompactEncrypted.The existing CI results show all four tests failing on those releases and passing on Windows 11 23H2 and Windows Server 2025. Build 22631 is the oldest confirmed passing version in that matrix; this does not establish the flag's exact introduction version on earlier, untested Windows 11 releases.
Older builds now use
OPEN_VIRTUAL_DISK_FLAG_NONE. Supported builds retain encrypted-VHD support. The encrypted-compaction test skips before creating a distribution on older builds. No new user-facing strings or documentation changes are needed.Validation Steps Performed
cmake --build . --clean-first -- -m- passed for the final changes..\FormatSource.ps1 -Verify $true- passed.git -c core.whitespace=cr-at-eol diff --check- passed.python3 tools\devops\validate-copyright-headers.py- failed during the full-tree scan with aUnicodeEncodeErrorwhile printing filenames. The existing validator'shas_headercheck passed for both changed files using:Runtime tests were not run locally to avoid replacing the installed WSL package and stopping active sessions. CI should verify
TestExistingSwapVhd,Resize,Compact, and the version-gatedCompactEncryptedtest across the Windows matrix.