Skip to content

fix(fs-core): preserve entries and symlink semantics in path operations - #1304

Open
sogav21 wants to merge 1 commit into
streamich:masterfrom
sogav21:fix/1303-node-filesystem-parity
Open

sogav21 wants to merge 1 commit into
streamich:masterfrom
sogav21:fix/1303-node-filesystem-parity

Conversation

@sogav21

@sogav21 sogav21 commented Nov 15, 2026

Copy link
Copy Markdown

Fixes #1303.

Preserve final symlinks in rename/rm, reject self-descendant directory renames before changing entries, reject directory hard links, protect existing files and dangling links during recursive mkdir, and report symlink target UTF-8 size with 0777 permissions. Rename also checks destination types and nonempty directories before mutation and keeps same-inode renames unchanged. Adds 42 regression/guard cases and updates three dependent expectations. Recursive mkdir preserves Node's sync/callback/promise errno distinction for dangling intermediate symlinks.

The reported dangling-symlink cpSync case is unchanged: native Linux Node 22.23.1 and 26.13.1 also return ENOENT, including the checked symlink options. This addresses the six demonstrated mismatches, without duplicating #1302's separate inode-release work.

Validation with locked Yarn 4.12.0:

  • Linux Node 26.13.1: yarn build, yarn typecheck, yarn prettier:check, and yarn test pass (101 suites, 1662 tests passed, 17 skipped, 14 snapshots).
  • Windows Node 26.13.1: build, typecheck and full tests pass (1661 passed, 18 skipped).
  • All 42 new cases pass after the fix. The exact final tests plus affected volume tests fail on original BASE as expected (38 failed, 184 passed, 14 skipped); the additional async cases also exposed four failures before the consumer correction.
  • Scoped TSLint reports nine existing violations, reproduced on BASE; no new diagnostics. The legacy root lint glob matches no source files.

Native parity probes cover Linux/POSIX behavior; native Windows symlink setup returned EPERM. The existing direct destination-parent symlink limitation remains: a rename into /alias/name can report ENOTDIR when /alias is a directory symlink. Implementation and tests were prepared with AI assistance and are submitted for maintainer review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rename/rm follow symlinks, rename into own subdirectory deletes the tree, and other fs mismatches

1 participant