Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: fix existsSync for invalid symlink at win32 #30556

Closed
wants to merge 2 commits into from
Closed

fs: fix existsSync for invalid symlink at win32 #30556

wants to merge 2 commits into from

Conversation

pd4d10
Copy link
Contributor

@pd4d10 pd4d10 commented Nov 20, 2019

Fixes: #30538

Background

#18618 uses access instead of stat to implement fs.existsSync. Unfortunately, seems the two approaches both have some limitations at Windows:

Expected behavior of existsSync stat access
Invalid symlink false
File without privileges true

This PR adds a double check only at win32 platform to fix this issue.

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

@nodejs-github-bot nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Nov 20, 2019
@pd4d10 pd4d10 changed the title fix: fs.existsSync for invalid symlink at win32 fs: fix existsSync for invalid symlink at win32 Nov 20, 2019
@pd4d10 pd4d10 mentioned this pull request Nov 20, 2019
2 tasks
@Trott
Copy link
Member

Trott commented Nov 20, 2019

@nodejs/platform-windows @nodejs/fs

@Trott Trott added the windows Issues and PRs related to the Windows platform. label Nov 20, 2019
@bzoz
Copy link
Contributor

bzoz commented Nov 20, 2019

The change looks reasonable. Rubberstamp LGTM if the test fails without this change.

lib/fs.js Outdated Show resolved Hide resolved
lib/fs.js Outdated Show resolved Hide resolved
@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 30, 2019
@nodejs-github-bot
Copy link
Collaborator

@addaleax
Copy link
Member

addaleax commented Dec 3, 2019

Landed in 0e3d774

addaleax pushed a commit that referenced this pull request Dec 3, 2019
Fixes: #30538

PR-URL: #30556
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@addaleax addaleax closed this Dec 3, 2019
@pd4d10 pd4d10 deleted the patch-5 branch December 4, 2019 05:37
targos pushed a commit that referenced this pull request Dec 9, 2019
Fixes: #30538

PR-URL: #30556
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Dec 13, 2019
targos pushed a commit that referenced this pull request Jan 13, 2020
Fixes: #30538

PR-URL: #30556
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
hyj1991 added a commit to X-Profiler/xprofiler that referenced this pull request Jan 17, 2020
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
Fixes: #30538

PR-URL: #30556
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fs.existSync returns true after fs. symlinkSync node 10 onwards in windows only
8 participants