Skip to content

Make mkdir follow intermediate symbolic links #119

Description

@abhinavgautam01

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions