Skip to content

fs: fix existsSync for invalid symlink at win32 - #30556

Closed
pd4d10 wants to merge 2 commits into
masterfrom
unknown repository
Closed

fs: fix existsSync for invalid symlink at win32#30556
pd4d10 wants to merge 2 commits into
masterfrom
unknown repository

Conversation

@pd4d10

@pd4d10pd4d10 commented Nov 20, 2019

Copy link
Copy Markdown
Contributor

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 existsSyncstataccess
Invalid symlinkfalse
File without privilegestrue

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-botnodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Nov 20, 2019
@pd4d10pd4d10 changed the title fix: fs.existsSync for invalid symlink at win32fs: fix existsSync for invalid symlink at win32Nov 20, 2019
@pd4d10pd4d10 mentioned this pull request Nov 20, 2019
2 tasks
@Trott

Copy link
Copy Markdown
Member

@nodejs/platform-windows @nodejs/fs

@TrottTrott added the windows Issues and PRs related to the Windows platform. label Nov 20, 2019
@bzoz

bzoz commented Nov 20, 2019

Copy link
Copy Markdown
Contributor

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

Comment threadlib/fs.js Outdated
Comment threadlib/fs.js Outdated
@addaleaxaddaleax 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
Copy Markdown
Collaborator

@addaleax

Copy link
Copy Markdown
Member

Landed in 0e3d774

addaleax pushed a commit that referenced this pull request Dec 3, 2019
Fixes: #30538
PR-URL: #30556
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@addaleaxaddaleax 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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorinsMylesBorins 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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targostargos mentioned this pull request Jan 15, 2020
hyj1991 added a commit to X-Profiler/xprofiler that referenced this pull request Jan 17, 2020
hyj1991 added a commit to X-Profiler/xprofiler that referenced this pull request Jan 18, 2020
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
Fixes: #30538
PR-URL: #30556
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Feb 8, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.fsIssues and PRs related to the fs subsystem / file system.windowsIssues 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

@pd4d10@Trott@bzoz@nodejs-github-bot@addaleax@bnoordhuis@jasnell@lundibundi