Skip to content

fs: fix infinite loop with async recursive mkdir on Windows

If file is a file then on Windows mkdir on file/a returns an ENOENT error while on POSIX the equivalent returns ENOTDIR. On the POSIX systems ENOTDIR would break out of the loop but on Windows the ENOENT would strip off the a and attempt to make file as a directory. This would return EEXIST but the code wasn't detecting that the existing path was a file and attempted to make file/a again.

Fixes: https://github.com/nodejs/node/issues/27198

cc @nodejs/fs @bcoe

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading