Description
WorkspaceFilesystem.mkdir does not use the shared symbolic-link resolver when it walks the target path. Its lookupChild helper reads each directory entry directly and treats every node other than a directory as an ENOTDIR error. A symbolic link to a directory therefore blocks directory creation instead of resolving transparently.
For example:
await fs.mkdir("/real");
await fs.symlink("/real", "/alias");
await fs.mkdir("/alias/new-directory");
The last call currently throws ENOTDIR. It should create /real/new-directory.
Other write paths, including writeFile, follow symbolic links and enforce the shared 40-hop limit. mkdir should provide the same behavior for absolute links, relative links, chains, dangling links and loops.
Expected outcome
- Follow symbolic links in intermediate path segments before creating a directory.
- Create the new directory under the resolved parent inode.
- Preserve
ENOTDIR when the resolved parent segment is a file.
- Return
ENOENT for a dangling parent link and ELOOP after more than 40 link traversals.
- Apply the same behavior to recursive directory creation.
- Add regression tests for absolute and relative links, recursive creation, dangling links and loops.
Description
WorkspaceFilesystem.mkdirdoes not use the shared symbolic-link resolver when it walks the target path. ItslookupChildhelper reads each directory entry directly and treats every node other than a directory as anENOTDIRerror. A symbolic link to a directory therefore blocks directory creation instead of resolving transparently.For example:
The last call currently throws
ENOTDIR. It should create/real/new-directory.Other write paths, including
writeFile, follow symbolic links and enforce the shared 40-hop limit.mkdirshould provide the same behavior for absolute links, relative links, chains, dangling links and loops.Expected outcome
ENOTDIRwhen the resolved parent segment is a file.ENOENTfor a dangling parent link andELOOPafter more than 40 link traversals.