Repository navigation
Conversation
uv_fs_copyfile() can copy file data to a WSL DrvFs mount and then fail while preserving its mode because fchmod() returns EPERM. DrvFs without metadata support cannot represent arbitrary Unix permissions, so treat that failure as best-effort for writable source files. Identify the exact destination mount through procfs and require the WSL-specific 9p aname=drvfs option without metadata. This avoids suppressing meaningful permission errors on generic 9p mounts and metadata-enabled DrvFs. Refs: nodejs/node#44261 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Zamiell <5511220+Zamiell@users.noreply.github.com>
bnoordhuis
reviewed
Sep 3, 2026
bnoordhuis
left a comment
Member
There was a problem hiding this comment.
At the very least you should first check that fstatfs sets s.f_type to 0x01021997 (V9FS_MAGIC) and share the syscall with uv__is_cifs_or_smb (no duplicate work)...
...having said that, I really don't want to parse multiple text files just to figure out if we're dealing with a buggy filesystem. Chances of this PR getting merged are slim.
1 of 2 tasks
Author
|
ok, sounds good, I opened this issue for Microsoft: microsoft/WSL#41519 |
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.
uv_fs_copyfile()can successfully copy data to a WSL DrvFs mount andthen fail with
EPERMwhile trying to preserve the source mode. DrvFswithout metadata support cannot represent arbitrary Unix permissions,
so mode preservation should be best-effort in that configuration, as it
already is for CIFS/SMB.
The destination is identified through its mount ID in
/proc/self/fdinfoand the corresponding/proc/self/mountinforecord.The exception requires the WSL-specific
9p+aname=drvfscombination and the absence of the
metadataoption, rather thanmatching every 9p filesystem.
The error is suppressed only for source modes containing a write bit.
DrvFs without metadata maps removal of all write bits to the Windows
read-only attribute, so failures that could leave a read-only source
writable remain visible.
Validation:
uv_run_tests_a fs_copyfile./mnt/cand compared theresulting contents.
fchmod(EPERM)and verified that it is suppressed for awritable source on DrvFs, but preserved on ext4 and for a read-only
source on DrvFs.
Refs: nodejs/node#44261
(For transparency, this PR was generated by GPT 5.6 Sol.)