Skip to content

test: migrate process.binding to internalBinding for misc. - #24952

Closed
BeniCheni wants to merge 12 commits into
nodejs:masterfrom
BeniCheni:misc-process-to-internal-binding
Closed

test: migrate process.binding to internalBinding for misc.#24952
BeniCheni wants to merge 12 commits into
nodejs:masterfrom
BeniCheni:misc-process-to-internal-binding

Conversation

@BeniCheni

Copy link
Copy Markdown
Contributor

Refs #22160

For the migrated modules from the checklist of #22160, this PR identifies the places of source code & tests with "legacy" process.binding, and follows up to migrate to internalBinding.

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

@nodejs-github-botnodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Dec 11, 2018
@BeniCheniBeniCheni changed the title src,test: migrate process.binding to internalBinding for misc.lib & test: migrate process.binding to internalBinding for misc.Dec 11, 2018
@BeniCheniBeniCheni changed the title lib & test: migrate process.binding to internalBinding for misc.lib,test: migrate process.binding to internalBinding for misc.Dec 13, 2018
Comment threadlib/stream.js Outdated
Comment threaddeps/node-inspect/lib/internal/inspect_repl.js Outdated
@BeniCheni

Copy link
Copy Markdown
ContributorAuthor

@addaleax,

Thanks for the insight. Reverted back to process.binding in lib/stream.js & deps/.

Comment threadtest/parallel/test-child-process-spawnsync-kill-signal.js Outdated
Comment threadtest/parallel/test-child-process-spawnsync-validation-errors.js Outdated
Comment threadtest/parallel/test-dgram-bind-fd.js Outdated
Comment threadtest/parallel/test-fs-readdir-types.js Outdated
Comment threadtest/parallel/test-process-constants-noatime.js Outdated
Comment threadtest/parallel/test-process-binding.js Outdated
@BeniCheni

Copy link
Copy Markdown
ContributorAuthor

Thanks for the feedback, @joyeecheung. Updated per suggestions. Please review again at convenience.

@BeniCheni

BeniCheni commented Jan 8, 2019

Copy link
Copy Markdown
ContributorAuthor

Hi reviewer(s),

Following up on this PR w. a rebase, and ran into "make lint" error:

Running JS linter...
/Users/bchen/github/node/test/parallel/test-accessor-properties.js
58:27 error Unused eslint-disable directive (no problems were reported from 'node-core/crypto-check')
✖ 1 problem (1 error, 0 warnings)

The source of test/parallel/test-accessor-properties.js is:

if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check

Is there any suggestion how to resolve this make lint error w. eslint-disable?

(The error shows "Unused", which seems to be a removal. But want to confirm w. your help. Thank you in advance!)

@cjihrigcjihrig mentioned this pull request Jan 8, 2019
3 tasks
@cjihrig

Copy link
Copy Markdown
Contributor

@BeniCheni I think you'll need #25395.

@BeniCheni

Copy link
Copy Markdown
ContributorAuthor

Thanks, @cjihrig. I'll look out for the landing of #25395 and rebase again.

cjihrig added a commit to cjihrig/node that referenced this pull request Jan 11, 2019
Use of process.binding() has largely been replaced by
internalBinding(). This commit updates the custom crypto
check ESLint rule to check for both process.binding() and
internalBinding().
Refs: nodejs#24952
PR-URL: nodejs#25395
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@BeniCheni

Copy link
Copy Markdown
ContributorAuthor

Hi reviewer(s), friendly reminder rebased after #25395, and CI is “green” again to further review. Thanks!

addaleax pushed a commit that referenced this pull request Jan 14, 2019
Use of process.binding() has largely been replaced by
internalBinding(). This commit updates the custom crypto
check ESLint rule to check for both process.binding() and
internalBinding().
Refs: #24952
PR-URL: #25395
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Jan 16, 2019
Use of process.binding() has largely been replaced by
internalBinding(). This commit updates the custom crypto
check ESLint rule to check for both process.binding() and
internalBinding().
Refs: nodejs#24952
PR-URL: nodejs#25395
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
@BeniCheni

Copy link
Copy Markdown
ContributorAuthor

Hello, reviewer(s),

Trying to follow up with this pending PR by rebasing & passing the CI by the commit to bring the PR up-to-date.

Please review at convenience, or let me that if this PR is not needed. I'll be happy to close it as well.

Comment threadtest/parallel/test-child-process-spawnsync-validation-errors.js Outdated
@BeniCheni

BeniCheni commented Feb 23, 2019

Copy link
Copy Markdown
ContributorAuthor

// Flags: --expose_internals

The flag is probably not needed?

Per @BridgeAR’s comment ☝️, removed the unused flag. Thanks.

@BridgeARBridgeAR mentioned this pull request Feb 26, 2019
3 tasks
@addaleaxaddaleax added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. and removed lib / src Issues and PRs related to general changes in the lib or src directory. labels Feb 26, 2019
Comment threadtest/parallel/test-process-binding-internalbinding-whitelist.js Outdated
In places of process.binding, migrate to adapt internalBinding, for
miscellaneous, identified source code & tests for various modules.
Refs: #22160
Revert the previous incorrect migration of internalBinding from
process.binding in lib/stream & inspect_repl.
Refs: #22160
@addaleax

Copy link
Copy Markdown
Member

@addaleaxaddaleax added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed needs-ci PRs that need a full CI run. labels Feb 28, 2019
@addaleax

Copy link
Copy Markdown
Member

@addaleaxaddaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 1, 2019
@addaleax

Copy link
Copy Markdown
Member

The fixup is pretty simple, doing the same we already do for internalBinding('crypto').

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

@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 4, 2019
@BridgeAR

Copy link
Copy Markdown
Member

@richardlau

Copy link
Copy Markdown
Member

tls_wrap also needs a common.hasCrypto check for the without ssl builds:

https://ci.nodejs.org/job/node-test-commit-linux-containered/11040/nodes=ubuntu1604_sharedlibs_withoutssl_x64/testReport/junit/(root)/test/parallel_test_process_binding_internalbinding_whitelist/

internal/bootstrap/loaders.js:131
mod = bindingObj[module] = getInternalBinding(module);
^
Error: No such module: tls_wrap
at internalBinding (internal/bootstrap/loaders.js:131:34)
at process.binding (internal/bootstrap/loaders.js:109:14)
at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-linux-containered/test/parallel/test-process-binding-internalbinding-whitelist.js:32:16)
at Module._compile (internal/modules/cjs/loader.js:807:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:818:10)
at Module.load (internal/modules/cjs/loader.js:674:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:870:12)
at internal/main/run_main_module.js:21:11

(The without ssl variant build (nodejs/build#1574) was only enabled in the last few days which is why it didn't show up in previous CI runs. This is exactly the kind of thing it's designed to catch.)

@BridgeARBridgeAR removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 5, 2019
@addaleax

Copy link
Copy Markdown
Member

@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 5, 2019
@BridgeAR

Copy link
Copy Markdown
Member

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

@addaleax

Copy link
Copy Markdown
Member

@BridgeAR

Copy link
Copy Markdown
Member

Landed in 53d4e04 🎉

@BridgeARBridgeAR closed this Mar 6, 2019
BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 6, 2019
Migrate various modules from using process.binding to internalBinding.
PR-URL: nodejs#24952
Refs: nodejs#22160
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@BridgeAR

Copy link
Copy Markdown
Member

I updated the commit message while landing.

@BeniCheni
BeniCheni deleted the misc-process-to-internal-binding branch March 6, 2019 23:41
@BeniCheni

Copy link
Copy Markdown
ContributorAuthor

Thanks for helping out with the CIs, @addaleax & @BridgeAR. Have learned a lot but observing the CIs errors and logs during landing workflow. 🙏

BridgeAR pushed a commit to BridgeAR/node that referenced this pull request Mar 12, 2019
Migrate various modules from using process.binding to internalBinding.
PR-URL: nodejs#24952
Refs: nodejs#22160
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
BridgeAR pushed a commit that referenced this pull request Mar 14, 2019
Migrate various modules from using process.binding to internalBinding.
PR-URL: #24952
Refs: #22160
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@davalapar

Copy link
Copy Markdown

Hi, bit unrelated but does this mean there won't be a way anymore to access process.binding('buffer') entirely, or will there be other ways to access it?

@addaleax

Copy link
Copy Markdown
Member

Hi, bit unrelated but does this mean there won't be a way anymore to access process.binding('buffer') entirely, or will there be other ways to access it?

@davalapar Eventually, yes. There shouldn’t be anything on that object that isn’t available through public APIs, and there are no stability guarantess about the contents of process.binding('buffer') anyway.

BethGriggs pushed a commit that referenced this pull request Apr 28, 2019
Use of process.binding() has largely been replaced by
internalBinding(). This commit updates the custom crypto
check ESLint rule to check for both process.binding() and
internalBinding().
Refs: #24952
PR-URL: #25395
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
BethGriggs pushed a commit that referenced this pull request May 10, 2019
Use of process.binding() has largely been replaced by
internalBinding(). This commit updates the custom crypto
check ESLint rule to check for both process.binding() and
internalBinding().
Refs: #24952
PR-URL: #25395
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 16, 2019
Use of process.binding() has largely been replaced by
internalBinding(). This commit updates the custom crypto
check ESLint rule to check for both process.binding() and
internalBinding().
Refs: #24952
PR-URL: #25395
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@BeniCheni@cjihrig@addaleax@BridgeAR@richardlau@davalapar@thefourtheye@joyeecheung@nodejs-github-bot