-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
npm throws an error on master #1898
Comments
It is caused by this change in fs.js. It breaks graceful-fs which is evaluating the code from fs in a context where internal modules are not allowed. |
/cc @isaacs |
Well, now we know the answer |
This allows userland modules to evaluate `fs` source without access to internals. Fixes: nodejs#1898
I wonder why this was not caught when I ran |
@thefourtheye |
@bnoordhuis But, requiring |
When you say 'other modules', do you mean 'core modules'? Those have access to internal modules so no problem there. The npm breakage is because graceful-fs does |
This allows `graceful-fs` to evaluate `fs` source without access to internals. See isaacs/node-graceful-fs#41 This is a temporary workaround that makes npm work. Fixes: nodejs#1898
This allows `graceful-fs` to evaluate `fs` source without access to internals. This is a temporary workaround that makes npm work. See: isaacs/node-graceful-fs#41 Fixes: nodejs#1898
This allows `graceful-fs` to evaluate `fs` source without access to internals. This is a temporary workaround that makes npm work. See: isaacs/node-graceful-fs#41 Fixes: #1898 PR-URL: #1903 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fixed in 2dcef83, though this should be fixed in |
@bnoordhuis Thanks for clarifying :) |
Thats indeed not optimal. Were there ever attempts in providing |
@silverwind There's been talk about having graceful-fs in core. Generally, the vote has come down to a "no" (and I've voted "no" as well). Some of the features in graceful-fs are totally fine, imo, and do belong in core. There's no reason why The biggest feature in graceful-fs is that it detects and avoids This is important to programs like npm that are in the business of unpacking a lot of tarballs and reading a lot of files, and want to parallelize to the maximum amount allowed by the operating system. However, there are situations where this behavior would be surprising, or even trigger problematic deadlocks! Rather than have an immediate failure from an Putting that behavior in core is a bad idea. However, this highlights the point that we do need a better way for this to work. Monkey-patching the core module caused a lot of problems because builtin modules are globals, so the change 8 levels deep in the tree could have strange impacts on consumers. (isaacs/node-graceful-fs#28) I don't have a great solution in mind. |
Maybe we could have a I'm not sure how npm would set something like that though... |
@Fishrock123 Really, what you want is a But, then you need to make sure that One approach would be for it to lock the code down at a particular version of Maybe we ought to split fs out into a separate module entirely, and vendor it into node core? |
Wow, this discussion is a bit over my head, but my prime reason for using It surprises me a bit that we don't get any bug reports in core regarding Windows file locking, maybe the issue isn't as widespread as I thought it is. Anyways, I'd probably be happy if we can get this feature alone into core, if it has no drawbacks (which it probably has). |
Just the first thing that pops into my mind: an application that silently stalls because of a deferred file operation will be much, much harder to debug than one that simply throws an error. On a philosophical level, graceful-fs-like behavior in core is way too much policy in the "mechanism, not policy" sense.
Please God, no. |
Well, you need to be sure that when this application opens files, it will close them promptly when it's done with them. Though, the same could be said of getting EMFILE or ENFILE errors on sockets, and we handle those gracefully. Why do it there and not for files? |
I'm not sure what you mean. The fd-stashed-away-for-hard-times trick? That's really just a hack to avoid busy looping with level-triggered listen sockets. Comparing that with graceful-fs is giving it way too much credit. :-) |
This is needed to give users a grace period before actually breaking modules that re-evaluate fs sources from context where internal modules are not allowed, e.g. older version of graceful-fs module. To be reverted in Node.js 7.0. Fixes nodejs#5097, see also nodejs#1898, nodejs#2026, and nodejs#4525.
This is needed to give users a grace period before actually breaking modules that re-evaluate fs sources from context where internal modules are not allowed, e.g. older version of graceful-fs module. To be reverted in Node.js 7.0 Fixes: #5097, see also #1898, #2026, and #4525. PR-URL: #5102 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This is needed to give users a grace period before actually breaking modules that re-evaluate fs sources from context where internal modules are not allowed, e.g. older version of graceful-fs module. To be reverted in Node.js 7.0 Fixes: nodejs#5097, see also nodejs#1898, nodejs#2026, and nodejs#4525. PR-URL: nodejs#5102 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Looks like a regression introduced in 6d95f4f.
/cc @vkurchatkin
The text was updated successfully, but these errors were encountered: