Skip to content

rmdirsync doesn't throw error when symlinked path is passed as argument in windows node 12 #31231

Open
@SparshithNR

Description

I have written a simple code to pin down the issue.
Env: Windows
Node version: 12

const fs = require('fs');

fs.mkdirSync("tmp");
fs.symlinkSync(".", "tmp/out");
console.log(`fs.existSync(tmp/out) : ${fs.existsSync('tmp/out')}`);
fs.rmdirSync('tmp/out');

Execution in CI:
Node 12

Build started
git clone -q --branch=rmdirsync https://github.com/SparshithNR/node-symlink.git C:\projects\node-symlink
git checkout -qf a6cb35fc2b3d2df328d4aeae3db65d732243142c
Restoring build cache
Cache 'C:\Users\appveyor\AppData\Local\Yarn' - Restored
Running Install scripts
Install-Product node $env:nodejs_version
Uninstalling node 8.16.2 (x86)...
Installing node 12.13.1 (x86)...
git rev-parse HEAD
a6cb35fc2b3d2df328d4aeae3db65d732243142c
yarn run test
yarn run v1.16.0
$ node index.js
fs.existSync(tmp/out) : true
Done in 0.27s.
Updating build cache...
Cache 'C:\Users\appveyor\AppData\Local\Yarn' - Up to date
Build success

Node 10:

Build started
git clone -q --branch=rmdirsync https://github.com/SparshithNR/node-symlink.git C:\projects\node-symlink
git checkout -qf a6cb35fc2b3d2df328d4aeae3db65d732243142c
Restoring build cache
Cache 'C:\Users\appveyor\AppData\Local\Yarn' - Restored
Running Install scripts
Install-Product node $env:nodejs_version
Uninstalling node 8.16.2 (x86)...
Installing node 10.17.0 (x86)...
git rev-parse HEAD
a6cb35fc2b3d2df328d4aeae3db65d732243142c
yarn run test
yarn run v1.16.0
$ node index.js
fs.existSync(tmp/out) : true
fs.js:114
    throw err;
    ^
Error: ENOENT: no such file or directory, rmdir 'tmp/out'
    at Object.rmdirSync (fs.js:684:3)
    at Object.<anonymous> (C:\projects\node-symlink\index.js:6:4)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Command exited with code 1

Code can be found here: https://github.com/SparshithNR/node-symlink/tree/rmdirsync
Windows Execution: https://ci.appveyor.com/project/SparshithNR/node-symlink/builds/29933274
Linux Execution: https://github.com/SparshithNR/node-symlink/runs/376483962

Activity

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

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions