GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fs: consistently return symlink type from readdir by ajafff · Pull Request #22808 · nodejs/node

Conversation

@ajafff

@ajafff ajafff commented Sep 11, 2018

Copy link
Copy Markdown
Contributor

Use 'lstat' to determine type of directory entry.
This is more consistent with the type returned from the readdir binding.
Also use 'path.join' over 'path.resolve' because 'name' is not absolute.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss and mrmlnc reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@nodejs-github-bot nodejs-github-bot added the fs Issues and PRs related to file-system APIs and the fs module. label Sep 11, 2018
@ajafff
fs: consistently return symlink type from readdir
6197ca2
Use 'lstat' to determine type of directory entry.
This is more consistent with the type returned from the readdir binding.
Also use 'path.join' over 'path.resolve' because 'name' is not absolute.
@ajafff
ajafff force-pushed the getdirents branch from 0a367f7 to 6197ca2 Compare September 11, 2018 18:48
@danbev

danbev commented Sep 19, 2018

Copy link
Copy Markdown
Contributor

CI: https://ci.nodejs.org/job/node-test-pull-request/17315/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Sep 19, 2018
View reviewed changes
addaleax
addaleax approved these changes Sep 24, 2018
View reviewed changes
@addaleax
addaleax requested a review from bengl September 24, 2018 20:45
@addaleax addaleax added author ready PRs with CI started, the required approvals, and no outstanding review comments. and removed author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Sep 24, 2018
@addaleax

addaleax commented Sep 24, 2018

Copy link
Copy Markdown
Member

I’m wondering whether this should be semver-major and/or an optional feature? There’s definitely a valid use case for having the non-lstat version also available…

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Sep 25, 2018

Copy link
Copy Markdown
Member

good question... I have no idea.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Sep 25, 2018

Copy link
Copy Markdown
Contributor

We could keep the existing behavior, and add an option for the lstat behavior. Then, in the next major release, potentially adjust which one is the default behavior.

jasnell reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ajafff

ajafff commented Sep 25, 2018

Copy link
Copy Markdown
Contributor Author

I don't want to introduce any new behavior in this PR. This tries to correct an inconsistency:
AFAICT the native binding returns the symlink's type as if lstat was used behind the scenes. Only if it returns an unknown kind it uses stat (in JS) to retrieve the missing information.

IMO this qualifies as semver-patch

addaleax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bengl

bengl commented Sep 25, 2018

Copy link
Copy Markdown
Member

I think lstat is the correct behavior, since the Dirent objects provide isSymbolicLink() and those need to be correct. This is semver-patch, since the previous behavior was inconsistent across platforms when directories contain symlinks.

If stat behavior is preferred, then the Dirent class should be changed to behave consistently. Either way, that would be a separate change from this one.

addaleax reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bengl
bengl approved these changes Sep 25, 2018
View reviewed changes
@addaleax

addaleax commented Sep 25, 2018

Copy link
Copy Markdown
Member

Thanks for the explanations, semver-patch sounds right then!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig
cjihrig approved these changes Sep 25, 2018
View reviewed changes
mhdawson
mhdawson approved these changes Sep 27, 2018
View reviewed changes

@mhdawson mhdawson left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mhdawson

mhdawson commented Sep 27, 2018

Copy link
Copy Markdown
Member

CI run: https://ci.nodejs.org/job/node-test-pull-request/17471/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson

mhdawson commented Sep 27, 2018

Copy link
Copy Markdown
Member

Opened issue for failure on Windows: #23127

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson

mhdawson commented Sep 27, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Resumed build and looks good except for one test that was yellow. Going to land. Link for resumed job https://ci.nodejs.org/job/node-test-pull-request/17473/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson

mhdawson commented Sep 27, 2018

Copy link
Copy Markdown
Member

Landed as 83864b3

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson mhdawson closed this Sep 27, 2018
mhdawson pushed a commit that referenced this pull request Sep 27, 2018
@ajafff @mhdawson
fs: consistently return symlink type from readdir
83864b3
Use 'lstat' to determine type of directory entry.
This is more consistent with the type returned from the readdir binding.
Also use 'path.join' over 'path.resolve' because 'name' is not absolute.

PR-URL: #22808
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
targos pushed a commit that referenced this pull request Sep 27, 2018
@ajafff @targos
fs: consistently return symlink type from readdir
58490d5
Use 'lstat' to determine type of directory entry.
This is more consistent with the type returned from the readdir binding.
Also use 'path.join' over 'path.resolve' because 'name' is not absolute.

PR-URL: #22808
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
targos pushed a commit that referenced this pull request Oct 3, 2018
@ajafff @targos
fs: consistently return symlink type from readdir
bb6530b
Use 'lstat' to determine type of directory entry.
This is more consistent with the type returned from the readdir binding.
Also use 'path.join' over 'path.resolve' because 'name' is not absolute.

PR-URL: #22808
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
@targos targos mentioned this pull request Oct 7, 2018
Release proposal: v10.12.0 #23313
Merged
This was referenced Oct 10, 2018
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#225
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#239
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#226
Closed
This was referenced Oct 11, 2018
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#240
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#227
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#241
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#242
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#228
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-android-nodejs#243
Closed
2018-10-10 Version 10.12.0 (Current) @targos beevelop/docker-nodejs#229
Closed
@bpasero bpasero mentioned this pull request Aug 10, 2019
1.37 Explorer not showing any files or folders microsoft/vscode#78743
Closed
bpasero referenced this pull request in microsoft/vscode Sep 10, 2019
@bpasero
Revert "debt - adopt new fs.readdir with stat info"
956208b
This reverts commit da5fb7d.
@coderabbitai coderabbitai Bot mentioned this pull request Jul 4, 2026
fix(ai-vault): make SSH session history host-aware stablyai/orca#7367
Merged
5 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bengl bengl bengl approved these changes
@jasnell jasnell jasnell approved these changes
@addaleax addaleax addaleax approved these changes
@cjihrig cjihrig cjihrig approved these changes
+1 more reviewer
@mhdawson mhdawson mhdawson approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

fs Issues and PRs related to file-system APIs and the fs module.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@ajafff @danbev @addaleax @jasnell @cjihrig @bengl @mhdawson @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.