-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
doc: update os.tmpdir() to discuss symlink results on macOS #31877
Conversation
I'm -.5 on documenting a platform quirk that 99% of the time should be inconsequential. sindresorhus/temp-write#8 seems to be about writing Node.js code to the temp dir, then loading that with Yes, |
I think I'd be better to remove the quirk entirely. And there's value in documenting these quirks (https://github.com/ehmicky/cross-platform-node-guide).
Probably even higher than that, but isn't it worth something making this less quirky? |
@fabiosantoscode What is the quirk here exactly, in your opinion? I’d consider it odd if Node.js did silently resolve symlinks for the temp directory. |
@addaleax that Node under macOS returns a symlink to the temp directory rather than its actual path as it does under other OS', or at least I think that's how it currently works since this isn't documented. Why would you consider it odd if Node always returned the actual path to the temp directory across all OS'? |
If another OS reports its temporary directory as a symlink, then Node.js will also report that there.
Because the concept of an “actual path” is a bit odd – yes, you can resolve symlinks, but you shouldn’t really have to. The whole idea of symlinks is that you can use them transparently instead of whatever path they point to. If it’s about the scenario described by Ben above, writing Node.js code to disk and then running it, then yes, Node.js does something weird – but it does so in the module loader, where it uses (I, personally, would still like to see a solution for that issue along the lines of nodejs/node-eps#46 (comment) – but that’s out of scope for this PR here, I’d say…) |
Yes I understand that's what's happening here. My point is that Node smooths over other differences already, and this looks like another small difference I'd expect it to smooth over too.
I don't understand what's your point, are you arguing for the removal of
I don't actually have a material use case for the change I'm arguing for, other than pushing for Node to be less quirky and reducing my bundles by a tiny amount since what |
No. (But I am unhappy about the fact that Node.js uses it in its module loader because it shouldn’t, yes.)
The former – the question is, why do you need the resolved path to the directory? The point of symlinks is that you shouldn’t have to. |
Shouldn't !== don't. I personally have never needed to know about this quirk, but perhaps a reasonable hypothetical scenario that breaks because of this could be the following:
Is this a reasonable-enough use case for either smoothing over this quirk or documenting it? |
@fabiospampinato That seems very hypothetical, and even if it happened, it doesn’t seem like that would be a common use case? And, again, I don’t see this as a “quirk”. But even if I did agree that there was a problem, there’s still the technical issue that Node.js shouldn’t silently perform sync fs operations under the hood, as mentioned in the linked issue. |
@addaleax I can't imagine it being a common use case, given how calling
Name it what you like, the important bit is that because Node doesn't smooth over this little difference things may unexpectedly not work across platforms, and the reason why they may not work across platforms isn't documented either.
Wait do you agree or not that in my hypothetical example above we have a problem?
Replied here: #11422 (comment) |
@fabiospampinato If you think it's a quirk worth addressing, why don't you petition Apple to move away from symlinks? That would fix it for everyone everywhere. |
@bnoordhuis because I feel it would be 100% a waste of my time, while here I feel there's a non-100% chance I'm wasting my time. |
c0b90c4
to
cde3551
Compare
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.
Making my objection explicit.
8ae28ff
to
2935f72
Compare
Given the objections that have been raised and the lack of further activity, closing this. It can be reopened if it is picked back up again. |
Closes: #11422
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes