test(drvfs): add O_APPEND ftruncate coverage, skip on virtiofs - #41032
Merged
Ben Hillis (benhillis) merged 1 commit intoJul 8, 2026
Merged
Conversation
Adds an ftruncate-on-O_APPEND check to the drvfs Basic test. It runs on plan9 (passes) and is skipped on virtiofs, which currently fails with EACCES due to a wsldevicehost bug (#40987): the Windows lxutil file server strips FILE_WRITE_DATA for O_APPEND, so SetEndOfFile is denied. A TODO in packages.config tracks removing the skip once an updated Microsoft.WSL.DeviceHost package ships the fix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR strengthens drvfs Linux unit test coverage by adding a regression check for ftruncate() behavior on a file descriptor opened with O_APPEND, while temporarily skipping the check on virtiofs where the underlying backend bug is still present.
Changes:
- Extend
DrvFsTestBasicto validate thatftruncate()succeeds on anO_APPEND | O_WRONLYdescriptor (and that the resulting file size matches expectations). - Skip the new check on virtiofs (with an informational log) to avoid known failures until the backend fix ships.
- Add a TODO note in
packages.configto bumpMicrosoft.WSL.DeviceHostand remove the virtiofs skip once the fix is available.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/linux/unit_tests/drvfs.c | Adds O_APPEND + ftruncate regression coverage in DrvFsTestBasic, with a virtiofs skip gate and log message. |
| packages.config | Documents the dependency bump TODO needed to remove the virtiofs skip once the fix is consumed. |
Blue (OneBlue)
approved these changes
Jul 8, 2026
Ben Hillis (benhillis)
deleted the
benhillis/drvfs-virtiofs-ftruncate-test
branch
July 8, 2026 20:19
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
Adds an
ftruncate-on-O_APPENDregression check to the drvfsBasicunit test. This scenario (open(O_APPEND | O_WRONLY)âwriteâftruncate) was previously uncovered, and it currently fails on virtiofs withEACCES, breaking real-world workloads (see #40987).Root cause is in the Windows lxutil file server (wsldevicehost): opening with
O_APPENDstripsFILE_WRITE_DATAfrom the NT access mask to enforce append-only writes, but the truncate path is issued on that same handle, soSetEndOfFileis denied. plan9 is unaffected because it doesn't map append semantics to a reduced NT access mask.Changes
test/linux/unit_tests/drvfs.câ newftruncate-on-O_APPENDcoverage inDrvFsTestBasic. It runs on plan9 and is skipped on virtiofs (gated ong_LxtFsInfo.FsType == LxtFsTypeVirtioFs) with aLxtLogInfonote, since the backend fix hasn't shipped yet.packages.configâ TODO aboveMicrosoft.WSL.DeviceHostto bump the package to a build containing the virtiofs fix and then remove the virtiofs skip.Validation
Built Debug and ran locally:
WSL2VirtioFs::DrvFsWSL2Plan9::DrvFsWithout the skip,
WSL2VirtioFs::DrvFsfails withftruncate(Fd, 0) failed: errno 13 (Permission denied), confirming the test reproduces the bug. clang-format clean.Once an updated
Microsoft.WSL.DeviceHostwith the fix is consumed, the virtiofs skip should be removed so the check runs on both transports.