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

Errors with ENOENT when directory is a dangling link #2

Closed
phated opened this issue Jan 14, 2018 · 8 comments · Fixed by #4
Closed

Errors with ENOENT when directory is a dangling link #2

phated opened this issue Jan 14, 2018 · 8 comments · Fixed by #4

Comments

@phated
Copy link
Member

phated commented Jan 14, 2018

I think we can either fix the error case or show a better error. Ref https://github.com/cristianl/testcase-vinyl-bug

cc @erikkemperman

@phated
Copy link
Member Author

phated commented Jan 17, 2018

@erikkemperman this probably got buried in other emails. Do you have any thought on what the behavior should be for mkdirp'ing on a dangling symlink?

@erikkemperman
Copy link
Member

@phated Sorry for late reply, pretty swamped just now... If the problem here is that we’re trying to create a directory under an ancestor which is a dangling link, I’d say throwing an error would be the correct thing to do.

Probably something went wrong earlier, and quietly replacing the dead link with a regular directory just makes that harder to track down.

Does that help?

@phated
Copy link
Member Author

phated commented Jan 22, 2018

The issue is that fs.stat fails with ENOENT when called on a dangling link - which we propagate. I think that's incorrect because something does exist on the filesystem, but it's that dangling link. I was also thinking we could maybe create a directory that the dangling link is pointing at. Not sure.

@phated
Copy link
Member Author

phated commented Jan 22, 2018

@erikkemperman So mkdir -p dangling-link/foo/bar errors with mkdir: dangling-link/foo/bar: Not a directory but mkdir -p symlink/foo/bar does the mkdirp at the target of the link. Maybe we should lstat/readlink and then mkdirp at the target?

@phated
Copy link
Member Author

phated commented Jan 22, 2018

Otherwise we could continue to error but do it with a better message? I want to determine the most intuitive behavior for this and don't necessarily want to mirror mkdir -p.

Also, this issue was brought to my attention because some user was trying to mkdirp at a dangling link.

@erikkemperman
Copy link
Member

IMHO the behaviour of mkdir -p makes a lot of sense, actually, the "danger" being that we'd be obfuscating an earlier problem otherwise. And actually the error message I am now seeing on your dangling-link branch is decent enough, it seems to me, in that it mentions the missing target at least. A trace would be nice, but that's part of a larger issue if I've been tracking things properly?

@phated
Copy link
Member Author

phated commented Jan 23, 2018

I guess it just feels wrong... I'm going to think on this some more.

@phated
Copy link
Member Author

phated commented Aug 25, 2022

Comments that I forgot to tie this to:
gulpjs/gulp#2086 (comment)
gulpjs/gulp#2086 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants