Giter Site home page Giter Site logo

Comments (8)

phated avatar phated commented on August 28, 2024

@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?

from fs-mkdirp-stream.

erikkemperman avatar erikkemperman commented on August 28, 2024

@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?

from fs-mkdirp-stream.

phated avatar phated commented on August 28, 2024

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.

from fs-mkdirp-stream.

phated avatar phated commented on August 28, 2024

@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?

from fs-mkdirp-stream.

phated avatar phated commented on August 28, 2024

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.

from fs-mkdirp-stream.

erikkemperman avatar erikkemperman commented on August 28, 2024

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?

from fs-mkdirp-stream.

phated avatar phated commented on August 28, 2024

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

from fs-mkdirp-stream.

phated avatar phated commented on August 28, 2024

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

from fs-mkdirp-stream.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.