GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — src: log warning on process.binding('natives') by bnoordhuis · Pull Request #2741 · nodejs/node Conversation
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we really say this in the warning?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the sole reason for this PR.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't know if other modules do the same. Why should we care only about graceful-fs?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it's probably the most used offender. The only other projects I could find with Github's (admittedly terrible) code search is an sys / util shim (which does seem to get copied around a lot, there's that.)
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I dislike calling out a specific module here, graceful-fs is really heavily used and is causing specific problems here. Perhaps the compromise is to leave the note in but put a
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 @rvagg
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. stderr is not buffered right? Should we really flush it?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. libc I/O can be buffered, that's why the fflush() is there.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
@bnoordhuis It looks like it was actually never done, and #2768 was closed a few days ago. Perhaps we should reopen this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
If this goes forward it should be updated to make use of the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This is used by old versions of graceful-fs but will stop working in the not too distant future. Print a warning so people know to upgrade.
6eab98e to
35a62c5
Compare
|
Rebased. Added a second commit that takes a different approach: check if the topmost JS frame is a builtin script.
Why? We don't do that for other warnings in C++ code either. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| fprintf(stderr, | ||
| "(node:%d) process.binding('natives') is deprecated.\n", pid); | ||
| fprintf(stderr, | ||
| "(node:%d) If you use graceful-fs < 4, please update.\n", pid); |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do recent versions of graceful-fs@3 still trigger this? It was updated just recently.
Update: they do, I verified that.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Another question: do we need to specifically note graceful-fs here? It's not the only package that uses process.binding('natives'), and that could lead people away from the actual issue.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Flashback: #2741 (comment)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@bnoordhuis yes, but see the list at #2741 (comment), that wasn't considered back then.
Also, graceful-fs@2 and graceful-fs@3 usage significantly decreased in past months.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I guess I could check if the caller is graceful-fs and customize the error based on that but meh. I have to be selective with my time in the next few weeks so I'm probably not going to expend too much effort on this PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If you don't have the time to work on it, I am willing to take it over.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
So that it can be consistently handled as a runtime deprecation just like any other deprecation warning we print. As illustrated by #8270, it's pretty trivial and has the built-in benefit of working with Update ... for instance, with the patch as it is currently: Using |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I found 268 lines in 147 packages using
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| auto caller_script_id = GetCallerScriptId(env->isolate()); | ||
| if (!IsInternalScriptId(env, caller_script_id)) { | ||
| // graceful-fs < 4 evals process.binding('natives').fs, which prohibits | ||
| // using internal modules in that module. Encourage people to upgrade. |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
which prohibits using internal modules in that module.
This is not accurate any more, they evaded that, and it now reevalutes internal modules with more dark magic, internal API usage, and relying on implementation details.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yes. Please be specific if you think there is something unintentional in there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@bnoordhuis Ok, I meant that the warning looks like too heavy to me, and most of those is cosumed by lines that do not bring much value (i.e. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Btw, one more thing: 4 packages actually assign to Could we stop that, like now, without waiting for a whole major release cycle? This shouldn't get misused even more. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
That would be nice, making props non-writable and non-configurable should be enough |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
+1 ... especially if we know we can do it without breaking non-test code. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I added the stack trace based on prior experience that if you don't, people are going to complain it's impossible to find out what is causing the warning. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Makes sense. But could we strip out lines that match |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Added a commit that does that (but in a better way than pattern matching strings.) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@bnoordhuis Thanks! Upd: yes, the warning looks good now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@bnoordhuis Sorry, I have another warning message stylistic question. How much extra code would it be to print the Upd: e.g. webpack does that on it's own, without graceful-fs. I can't guarantee that that exact code is commonly triggered, but webpack has almost 2 millon downloads per month. It's not an argument against this PR (the fix for webpack is straightforward), it's an argument for not confusing those users with graceful-fs specific mesages. Btw — is this semver-patch or semver-major? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm -1 on this as is given that it is printed as a deprecation but does not properly follow the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jasnell, would you change your mind if this would follow the command-line flags? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yep... see #2741 (comment) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
However, please keep in mind that the new fix for graceful-fs uses the natives module which uses |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@jasnell, older graceful-fs@3 versions used |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yep, just wanted to make sure it was noted. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The JS API has no way to do the internal stack frame filtering that @ChALkeR requested, and besides, other deprecation warnings from C++ (e.g. deprecated Template::Set usage) don't use it either. I could argue the PR in its current shape is more consistent with existing practices than it would be if I included your suggestion. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
At the very least |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Just a note: I would be fine with not filtering if printing the trace would be behind a flag. I don't have any specific opinion on printing from js vs printing from the C++ side here at the moment, though. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
c133999 to
83c7a88
Compare
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.