Skip to content

fix(mkdir): reject non-directory links with parents option - #1296

Open
Sskift wants to merge 1 commit into
shelljs:mainfrom
Sskift:fix/mkdir-reject-nondirectory-links
Open

Sskift wants to merge 1 commit into
shelljs:mainfrom
Sskift:fix/mkdir-reject-nondirectory-links

Conversation

@Sskift

@Sskift Sskift commented Nov 2, 2026

Copy link
Copy Markdown

With -p, mkdir() currently accepts any existing entry that is not a regular file. A symlink to a file and a dangling symlink therefore return success even though the requested directory does not exist.

Follow existing links when checking -p destinations and require a directory. Keep dangling links intact while reporting File exists. Error reporting now happens outside the filesystem probe's catch block so config.fatal errors propagate.

Validation on Windows with Node 24:

  • New file-link and dangling-link regressions fail on the original code; directory-link and multiple-destination controls pass.
  • All 22 mkdir tests and the full ESLint check pass, including a fatal-error regression.
  • Full suite: 658 pass, 6 skip, with the same three baseline Windows failures (two command-not-found expectations and a find symlink case).

AI assistance was used to develop and validate this change. The new fixtures ran with real Windows symlinks and junctions; native Unix validation has not been performed locally.

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.

1 participant