| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@ChALkeR ... Would it be possible to do another ecosystem scan on the current state of Buffer use? |
Sorry, something went wrong.
I run a query on a Gzemnid db from 02-2017, it overflowed, but I estimate that there are ~10KLoCs in several 100s of packages using new Buffer( |
Sorry, something went wrong.
|
I think we're still not far enough along in the adoption of the new Buffer methods to pull this off, at least not in time for 9.0.0. My recommendation would be to let this sit for a while longer. Ping @nodejs/tsc |
Sorry, something went wrong.
|
@jasnell As far as I can tell from the deprecation policy, there are no conditions for runtime deprecation related to the adoption of alternative APIs. It only says Documentation-Only Deprecations may land in a Node.js minor release but must not be upgraded to a Runtime Deprecation until the next major release and 9.0.0 will be the third major release since the documentation-only deprecation landed. If in your opinion these conditions are insufficient, then perhaps the deprecation policy should be updated to precisely define the adoption requirements that must be fulfilled before runtime deprecation can land. Otherwise I'm afraid runtime deprecation of the Buffer constructor (and likely other things in the future) will remain a constantly moving target. |
Sorry, something went wrong.
|
It's not so much a limitation of the policy. That is, there's nothing in the policy that says we can't move to a runtime deprecation right now, I'm just not convinced that it's a good idea yet. Also, don't get me wrong, I want to have a runtime deprecation here. |
Sorry, something went wrong.
|
I am -1 to land this without hard data that the community has moved to the new API. |
Sorry, something went wrong.
That's my concern, deciding when it's a good idea on ad-hoc basis might lead to inconsistent handling of deprecations and frustration for everyone involved.
Could you clarify what you mean by breakage and how you evaluate its amount? |
Sorry, something went wrong.
|
To clarify, this would only be on the v9.x branch and not be backported to v8.x? |
Sorry, something went wrong.
|
@ChALkeR did some checks in the past, as far as I can remember. I expect this to still be highly used. I am still adding safe-buffer to multiple modules every month, and the process is definitely not finished. Again, I've never been in favor and there is very little evidence to change my mind. I'd be very happy if this happens anyway, but it would require a TSC vote. I might be ok to land this in Node 10, then all supported Node.js lines would have had the new API from the x.0.0 release. |
Sorry, something went wrong.
That is correct. This would be a semver-major change. |
Sorry, something went wrong.
|
I'm trying to compile a full report (LOCs & Package numbers with new Buffer() vs. those with Buffer.*) |
Sorry, something went wrong.
|
Would it make sense to do a CITGM run on this PR? I don't expect the results to change anyone's mind, but perhaps a clean CITGM run would be A Good Start anyway to keep conversation focused on things we can observe and measure. |
Sorry, something went wrong.
I'll trigger a run, at the end of the day. |
Sorry, something went wrong.
Sorry, something went wrong.
All supported Node.js lines (4.x, 6.x and 8.x) already have the new API, see 7090481. Node 10 will be LTS, which probably means more people will install it, and therefore more people will see the warning if it lands in 10.0.0 compared to 9.0.0 (unless the usage of Buffer() drops significantly in 6 months). |
Sorry, something went wrong.
Node 4.3.2 is still fairly popular inside lambda, and it does not have that API. If Buffer() continue to be used, then no, I'm 👎 on this change. However, you can proactively go and fix the ecosystem. I have been doing that extensively, but we are not there yet. If 10 is too early, then it might be 11 or 12. |
Sorry, something went wrong.
It's unsupported, so how is it relevant to your statement regarding supported Node.js lines?
Thanks for your suggestion. Unfortunately, many module maintainers aren't eager to proactively move to new APIs, see for example browserify/browserify#1647 and izy521/discord.io#72. (Which I can totally understand, which brings us back to my point about --pending-deprecation. As it is now, people don't see any reason to believe the API will be runtime deprecated any time soon, so they don't see any point in code churn.) |
Sorry, something went wrong.
|
The way most companies work with Node, is that they do not think "node 4 LTS" is a moving target, but in fact they think of it as a group of releases. Node 4.3.2 is a point-in-time release that does not have this feature, and it never will because it's released. So, an author cannot say that my module XYZ supports Node 4 if they use the new methods, but rather Node 4.5+. Saying to leading module authors "we do not care about your opinion and we will force you to update" is a message that I cannot support. Convince them to migrate to the new API, and then make the switch. |
Sorry, something went wrong.
|
The fact that Buffer is basically a shortcut to alloc() and from() doesn't make me feel like going full deprecation is urgent, or possibly necessary. Are there any security risks to still using it (except for passing in a number when the user thought it was a string, without an encoding)? IMO the first thing that should happen is to update the docs and remove all the new from new Buffer(). It's useless. Actually, random shot but possibly worth while, what about only fully deprecating the usage of new Buffer() first? |
Sorry, something went wrong.
|
/me thinks out loud .... Eventually I'd really like to see us move away from Buffer entirely in favor of Uint8Array, while keeping the ability to create non-initialized Uint8Array instances... but that's just crazy talk. |
Sorry, something went wrong.
AFAIK none other than the two I listed in OP. But we don't runtime deprecate only due to security risks, do we?
I thought you were interested in turning Buffer into an ES6 class. Encouraging dropping new would be counterproductive to that. |
Sorry, something went wrong.
|
So how do we progress here? It seems like there are still quite a few -1. I am relatively certain that this is still used quite a lot in the wild but I also do not think that a lot of people care much. Convincing everyone will be very hard and not possible out of my perspective. I personally think it might be a good idea to print out the warning in case numbers are passed to the constructor as that is the main pain point and far less people use it like this. So this might be a compromise between fully deprecating the constructor now or later? I guess this is mainly a decision for the @nodejs/tsc |
Sorry, something went wrong.
A PR to do that along with CITGM results might be useful. It would be interesting (and possibly useful in pushing things forward) to compare those CITGM results with the CITGM results of a full runtime deprecation. (Of course, all that might also be a lot of work that convinces nobody of anything. So, you know, just don't do it if you're going to be resentful if that turns out to be the result.) |
Sorry, something went wrong.
|
@seishun this is definitely something that should land at some point but I doubt that this is going to happen in the next six month. Do you want to keep this open and get the opinion of the TSC about it or would it be fine to close this? |
Sorry, something went wrong.
|
Also, even if the package gets fixed, other packages relying on unfixed versions is also a giant problem out there. Ignoring node_modules would not help. |
Sorry, something went wrong.
|
We should notify end users that there is problematic code in their deps, and full deprecation is currently the only way how we can do that. I have ideas how to improve that in the future (automatic ecosystem code/deps analysis, automatic notifications, and stuff), but that won't be ready soon, and the Buffer issue needs to get fixed. The said analysis/notifications are now done in semi-manual way (basically — I file PRs), and that will also help to minimize the negative effects. |
Sorry, something went wrong.
Could you clarify how being more explicit on how to fix this problem would decrease the burden to maintainers? Do you think there are many maintainers who don't know how to fix this problem? |
Sorry, something went wrong.
|
@seishun I have been filing the PRs, and this is indeed non-trivial in some cases. |
Sorry, something went wrong.
Let's make an example: module A is using Buffer(string), but the developer is using module B, which depends on A (B -> A). Very likely, the end user will open an issue on B, not A. This only creates maintenance burden for B's maintainer. |
Sorry, something went wrong.
Which is correct, since B's maintainer would need to bump A's version anyway. Also, A could be unmaintained.
Could you provide some examples? |
Sorry, something went wrong.
@Trott, since the TSC has approved runtime-deprecating Buffer constructor, does this still need to be on tomorrow's agenda? IMHO the issue tracker is a much better place to discuss implementation details than a meeting. |
Sorry, something went wrong.
|
@fhinkel This appears to have stalled. If @mcollina can respond to @seishun's last comment, we can remove it from the agenda. Otherwise, time is short to get this landed with enough time to back out if it turns out to have more far-reaching negative impact than anticipated. So I'd prefer it stay on the agenda if it's not making any progress. Also, we probably want to review #19079 at the meeting if there isn't movement on the items in that list and/or no conversation in that issue. |
Sorry, something went wrong.
This is not correct, as fixing this by using safe-buffer is not semver-major change, and it would not require any action from B's author. This is what caused the massive community uproar the last time. With the current error message, B author would received a lot of heat, but he will not be able to do anything about it because the problem is in A. A author should receive the pressure to update, and ideally backport the fix to old release lines. Having issues opened on B would only increase the frustration of B's author. I keep my -1 on landing this without a deprecation message change, we need to point to a guide that explains to our users how to fix this. I'm happy if this goes to a placeholder document for now, and the guide is filled in a follow-up PR. If you want to progress anyway, we can vote on this on the next @nodejs/tsc meeting. @Trott the question for @seishun was to a comment @ChALkeR made #15346 (comment). |
Sorry, something went wrong.
That wouldn't work if B depends on an exact, or a very old, version of A, or if A is unmaintained. Personally, I don't see any issues with informing B's author about an issue in a dependency either way. They may choose to wait until A is fixed, or they may choose to just drop A if it happens to be a trivial change.
Even if we agree on what the guide should say, this is something that would apply to all deprecation warnings. I suggest discussing it in a separate issue, rather than singling out Buffer constructor. |
Sorry, something went wrong.
We got several tweets and emails because of this in the past. It is very annoying if you are maintaining some popular packages.
Very likely we should, but in all the other runtime deprecations we have never deprecated a massively used API. It's must on this one. |
Sorry, something went wrong.
|
I suppose in that case the TSC should decide whether the Buffer warning needs special treatment, or we need to come up with a generic guide to be provided with all deprecation warnings. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Not sure. I could either update this PR to do the deprecation warning everywhere or just make a new one. I'm fine either way. |
Sorry, something went wrong.
|
@seishun I believe it is probably best to open a new one as this is pretty much the oldest open PR and old PRs do not get as much attention (even though this one probably does not lack any attention ;-) ). I guess opening a new one could actually very soon target 11.x. |
Sorry, something went wrong.
|
@seishun what's the status on this? Is this abandoned or are you still working on it? |
Sorry, something went wrong.
|
I would like to know whether I should rebase this PR or create a new one. @nodejs/collaborators what do you think? 👍 rebase |
Sorry, something went wrong.
|
@seishun ow, the dreadful mention. If I were you, I'd probably choose by myself. Any of the two methods work and both have their merits. |
Sorry, something went wrong.
|
Sorry for the mention and thanks for the input. Closing to create a new PR. |
Sorry, something went wrong.
|
Awesome! Looking forward to it. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Creating a new PR as suggested in #7152 (comment).
Some backstory:
Several reasons for enabling runtime deprecation by default, in no particular order:
Checklist
Affected core subsystem(s)
buffer