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.lstat() of a linked directory returns false from stat.isDirectory() #25342

Closed
avoidwork opened this issue Jan 4, 2019 · 5 comments
Closed
Labels
fs Issues and PRs related to the fs subsystem / file system. question Issues that look for answers.

Comments

@avoidwork
Copy link

  • Version: v10.11.0
  • Platform: Darwin kuma 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
  • Subsystem: fs

It appears that fs.lstat() has regressed, such stats.isDirectory() will always return false regardless if the path is an actual directory.

screenshot example:
screen shot 2019-01-04 at 12 25 41 pm

@addaleax addaleax added question Issues that look for answers. fs Issues and PRs related to the fs subsystem / file system. labels Jan 4, 2019
@addaleax
Copy link
Member

addaleax commented Jan 4, 2019

Your example seems to be working as intended: The difference between lstat and stat is that lstat returns information about the link itself, if the path points to one, so you get information about ./x, not ../x. And ./x is a symbolic link, not a directory.

@avoidwork
Copy link
Author

@addaleax since fstat is for a descriptor, and stat is not for a link, how do you check if a symlink is a dir using fs?

@addaleax
Copy link
Member

addaleax commented Jan 4, 2019

@avoidwork You don’t want fstat if you don’t have a file descriptor. Just using plain stat should do, if I understand you correctly.

@avoidwork
Copy link
Author

i need more coffee; i didn't realize lstat was intended for the link itself, i erroneously assumed it was a stat for the linked object :D

@avoidwork
Copy link
Author

screen shot 2019-01-04 at 12 40 26 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

2 participants