Repository navigation
write tool cannot create new files on exFAT volumes (Windows): EISDIR from hard-link no-replace publication #5127
Closed
llrllr0123
started this conversation in
General
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
On Windows, the
writetool fails to create a new file when the workspace sits on an exFAT volume (e.g. an external USB drive). Overwriting an already-read file withwrite(or editing withedit) works fine. No configuration/workaround exists on the DSH side.Environment
Symptom
Reproduced in the workspace root and in every subdirectory (
.tmp, etc.). It is not a sandbox/permission issue: pwsh-level writes (e.g.Set-Content) succeed on the same paths. The failure is deterministic and happens for any new file.Root cause
writeFileAtomicinpackages/fs/fs-local/src/fsio.tspublishes new files through thecreateIfAbsentbranch, which uses a hard link as its no-replace primitive:exFAT does not support hard links, so
CreateHardLinkWfails; libuv maps that failure to EISDIR, and the error is treated as a plain IO error instead of (or in addition to) the intended "target exists" case. Replacement writes (edit / overwrite of an observed file) take the WindowsReplaceFileWpath on win32, which exFAT does support — hence only create-new-file is affected.Relevant lines:
packages/fs/fs-local/src/fsio.ts(writeFileAtomic, around lines 533-614); no-replace semantics also covered bypackages/fs/fs-local/tests/filesystem.spec.ts(createIfAbsent tests).Suggested fix
When
linkfails with a "filesystem does not support hard links" class of error (EISDIR / EPERM / ENOTSUP), fall back to a publication that preserves no-replace without hard links, e.g.:renamethe staged file into place — accepts a small TOCTOU window (a concurrent creator race becomes last-writer-wins instead of a rejection on such filesystems).wx(CREATE_NEW) and copy/fsync the staged content — native exclusive-create, no hard links, but not strictly atomic.linkon a probe file) and remember unsupported volumes for the session.A fix should keep the existing createIfAbsent tests green on NTFS (hard-link path unchanged there), and ideally add an exFAT/reparse test if feasible on CI.
Happy to provide a patch if a maintainer confirms the direction.
All reactions