-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: add a temporary fix for re-evaluation support #5102
Conversation
This does not cancel the fact that |
bce08a6
to
399137c
Compare
399137c
to
54ec1a8
Compare
Hmmmm, would it be possible to use |
if (process.throwDeprecation) | ||
throw new Error(msg); | ||
else if (process.traceDeprecation) | ||
console.trace(msg.startsWith(prefix) ? msg.replace(prefix, '') : msg); |
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.
msg.startsWith(prefix)
is logically always true, isn't it? Also, I wouldn't use .replace()
, I'd use .slice(prefix.length)
.
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.
That code was directly copied from internal/util
, it doesn't look optimal to me either.
I can make it a bit cleaner here, should I?
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.
I would. I'd fix up internal/util
while you're at it (in a separate commit.)
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.
@bnoordhuis I made this a bit cleaner here, but I don't think that the changes for internal/util
need to go into this PR. Perhaps a separate one would be better.
Is it possible and not-onerous to write a test for this? EDIT: Like, maybe something that confirms that a sensible-ish message is being provided when the situation arises? |
printDeprecation('fs: re-evaluating native modules sources is not ' + | ||
'supported. If you are using graceful-fs module, update ' + | ||
'it to a recent version.', | ||
false); |
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.
nit: perhaps reword a bit to, re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update to a more recent version.
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.
Done.
LGTM with a nit |
As per #4525 (comment) I'm suggesting we also go with just removing #4525 from This solution is kind of gross but lgtm since there's no other good way around it as far as I can tell. |
@rvagg Why was a |
sorry, wires crossed, ignore my comment |
54ec1a8
to
f9f35db
Compare
The warning (and an error in 7.0) is only thrown if it's not possible to load |
LGTM. Should we have a tracking issue to have the |
This reverts commit 1124de2 which landed in nodejs#4525 This commit has broken both npm + node-gyp How did it break npm? Deprecating fs.read's string interface includes `internal/util` Currently npm's dep tree includes an old version of graceful-fs that is monkey patching fs. As such everything explodes when trying to require `internal/util` nodejs#5102 is waiting for review but has not landed. We should revert ASAP to fix master while we decide what to do.
LGTM if it works and Ci is happy |
Also worth mentioning that I just submitted #5166 which tests the edge case this broke (re: npm). |
@ChALkeR feel free to cherry-pick my test 😄 : |
-1. this is just ridiculous |
@thealphanerd, it's not directly related. Your test is for |
ok, so now we don't have consensus on this PR, and I don't imagine we are getting it soon. Can we please revert the original PR and reopen it so that we can fix master. edit: I want to add that I do not think that reverting means the other should not land again, and potentially not land again quickly. master has been effectively broken since Friday, and I feel a sense of urgency to get things working again. |
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>
Correct me if I'm wrong, but shouldn't this be |
@Fishrock123 indeed. |
@thealphanerd This is not semver-major itself, but it depends on a semver-major commit (and adds a temporary fix on top of it). |
Perhaps someone find it useful - not a solution, but a temporary walk-around for graceful-fs and alike modules: https://gist.github.com/bondden/2d2e07d18d94d1f4dc23b7dcf9b0e350 |
@ChALkeR I'm not sure that the error message in this PR is very helpful to users. Almost every single app or node script that I run now displays this message. For example, when building Atom:
Or when running an Ember app:
The message doesn't show a stack trace, nor is it clear what module the problem is originating from, so there's no easy way to find out where to go to ask for a fix or what package to update. Can this message be updated to be a bit more descriptive and maybe limit the amount of times it's shown? In it's current form, while it's not an error, it's not very useful and I feel it will still cause a lot of confusion amongst users. |
@adambuczynski
I haven't seen any real-world case when it wasn't caused by a
It is already limited to 1 time per node process, unleast you have multiple old versions of graceful-fs installed, all of which should be updated. It looks reasonable to me to just print the message several times then, given that the code to track this further would introduce other undesired changes (storing a flag in another module, storing a flag in global scope, etc.). |
Ideally, yes everyone should do that. But by everyone you mean package maintainers, and package maintainers can only realistically be asked to maintain the dependencies of their own package. I have the same gripe with this "error" message as with the "prefer global" warning that End users or a package or script don't really care if some nested package of some dependency somewhere down the line in the dependency tree has a deprecated Basically I feel that this deprecation warning should be thrown by
Ok I didn't know that, yes fair enough. |
@adambuczynski
It is thrown at both install time and in runtime. Just install time is not an option, because we can't guarantee that it's caused by |
You can use |
Note that those versions of |
Not really, when I build Atom I just run script/build, and I don't think it supports node arguments.
Let's hope it works and the messages are banished from our world within a week or two :) |
That's not really our fault. The flags for deprecations have been around for years. You should probably check, and if it is not capable of passing flags, we should probably prompt them for at least |
Of course, I'm not saying it is, but the point I'm trying to make is that even if it were available, I am not a developer or maintainer of Atom. As such, I don't care if their build script has deprecations or warnings because of the packages it (or its dependencies) use. I just want it to run and build the latest version of Atom for me without nagging me about the same deprecation 20 times :) Those errors are good for developers / package maintainers to see and get warned about, not so much end users. I understand it's hard from a Node perspective to differentiate between the two, and that's why I thought it would be sufficient to issue deprecation warnings when a package installs the deprecated dependency. However as ChALkeR mentioned that's not an option here, so we're kind of stuck with this message it seems. |
Help Me to solve this problem.
|
@maniJoe Post questions at https://github.com/nodejs/help/issues, don't spam random issues. |
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 ofgraceful-fs
module.To be reverted in Node.js 7.0.
Fixes #5097, see also #1898, #2026, and #4525.