FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

buffer: move setupBufferJS to internal by bengl · Pull Request #16391 · nodejs/node · GitHub

/ node Public

buffer: move setupBufferJS to internal - #16391

Closed
bengl wants to merge 1 commit into
nodejs:masterfrom
bengl:bengl/bufferbindingfix
Closed

buffer: move setupBufferJS to internal#16391
bengl wants to merge 1 commit into
nodejs:masterfrom
bengl:bengl/bufferbindingfix

Conversation

bengl commented Oct 22, 2017

Copy link
Copy Markdown
Member

Stashing it away in internal/buffer so that it can't be used in userland, but can still be used in internals.

/cc @Fishrock123 @addaleax since we've previously talked about doing this.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

buffer

nodejs-github-bot added the buffer Issues and PRs related to the buffer subsystem. label Oct 22, 2017

bengl commented Oct 22, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

CI: https://ci.nodejs.org/job/node-test-pull-request/10911/

And since this modifies process.binding('buffer'), CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1025/

Comment thread lib/internal/buffer.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Not blocking, and up for debate:
Since this changes global state, maybe move this to node_bootstap, or explicitly require with a comment. Otherwise AFAICT it will run as a side effect of

global.Buffer = NativeModule.require('buffer').Buffer;
which is not obvius

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hmm, I'd like to keep the caching and removing of setupBufferJS in the same place. Would a comment in bootstrap_node.js clarifying that requiring buffer also removes the setupBufferJS from the binding be sufficient to clarify? Something like:

// Note that this requires `lib/internal/buffer.js`, which removes `setupBufferJS`
// from the buffer binding.
global.Buffer = NativeModule.require('buffer').Buffer;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Another viable option is to add this to bootstrap_node.js

// This require as side effect removes `setupBufferJS` from the buffer binding.
NativeModule.require('internal/buffer.js');

bengl Oct 22, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Cool, I'll throw a comment and explicit require in. Stay tuned.

bengl force-pushed the bengl/bufferbindingfix branch from 17e4f98 to a8aaaac Compare October 22, 2017 23:01

bengl commented Oct 22, 2017

Copy link
Copy Markdown
Member Author

I've just realized the commit message is wrong. Fixing it now.

Stashing it away in internal/buffer so that it can't be used in
userland, but can still be used in internals.
bengl force-pushed the bengl/bufferbindingfix branch from a8aaaac to ecd7dc6 Compare October 22, 2017 23:11
bengl changed the title buffer: move setupBindingJS to internal buffer: move setupBufferJS to internal Oct 22, 2017

jasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM with green CI

bengl commented Oct 25, 2017

Copy link
Copy Markdown
Member Author

Alright here's another round of CI and CITGM, since this has changed slightly as per @refack's review.

CI: https://ci.nodejs.org/job/node-test-pull-request/10955/
CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1028/

jasnell commented Oct 25, 2017

Copy link
Copy Markdown
Member

CI failures are unrelated

jasnell pushed a commit that referenced this pull request Oct 25, 2017
Stashing it away in internal/buffer so that it can't be used in
userland, but can still be used in internals.

PR-URL: #16391
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

jasnell commented Oct 25, 2017

Copy link
Copy Markdown
Member

Landed in 8172f45

jasnell closed this Oct 25, 2017
addaleax pushed a commit to ayojs/ayo that referenced this pull request Oct 26, 2017
Stashing it away in internal/buffer so that it can't be used in
userland, but can still be used in internals.

PR-URL: nodejs/node#16391
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

gibfahn commented Oct 30, 2017

Copy link
Copy Markdown
Member

Should this be backported to v8.x-staging? If yes please follow the guide and raise a backport PR, if no let me know or add the dont-land-on label.

bengl commented Nov 4, 2017

Copy link
Copy Markdown
Member Author

@gibfahn I think in order to avoid the circular dependency issue (https://github.com/nodejs/node/blob/v8.x-staging/lib/buffer.js#L1501-L1503) (not an issue on master/9.x) it may not make sense to backport this commit as it's implemented. That is, putting setupBufferJS into internal/buffer might not make sense on 8.x.

addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
Stashing it away in internal/buffer so that it can't be used in
userland, but can still be used in internals.

PR-URL: nodejs/node#16391
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buffer Issues and PRs related to the buffer subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL