Skip to content
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

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

Closed
wants to merge 12 commits into from
Closed

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

wants to merge 12 commits into from

Conversation

BeniCheni
Copy link
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-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Dec 11, 2018
@BeniCheni BeniCheni changed the title src,test: migrate process.binding to internalBinding for misc. lib & test: migrate process.binding to internalBinding for misc. Dec 11, 2018
@BeniCheni BeniCheni changed the title lib & test: migrate process.binding to internalBinding for misc. lib,test: migrate process.binding to internalBinding for misc. Dec 13, 2018
lib/stream.js Outdated Show resolved Hide resolved
deps/node-inspect/lib/internal/inspect_repl.js Outdated Show resolved Hide resolved
@BeniCheni
Copy link
Contributor Author

@addaleax,

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

test/parallel/test-child-process-spawnsync-kill-signal.js Outdated Show resolved Hide resolved
test/parallel/test-dgram-bind-fd.js Outdated Show resolved Hide resolved
test/parallel/test-fs-readdir-types.js Outdated Show resolved Hide resolved
test/parallel/test-process-constants-noatime.js Outdated Show resolved Hide resolved
test/parallel/test-process-binding.js Outdated Show resolved Hide resolved
@BeniCheni
Copy link
Contributor Author

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

@BeniCheni
Copy link
Contributor Author

BeniCheni commented Jan 8, 2019

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!)

@cjihrig
Copy link
Contributor

cjihrig commented Jan 8, 2019

@BeniCheni I think you'll need #25395.

@BeniCheni
Copy link
Contributor Author

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
Contributor Author

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
Contributor Author

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.

@BeniCheni
Copy link
Contributor Author

BeniCheni commented Feb 23, 2019

// Flags: --expose_internals

The flag is probably not needed?

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

@addaleax addaleax 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
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
Member

@addaleax addaleax 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
Member

addaleax commented Mar 1, 2019

@addaleax addaleax 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
Member

addaleax commented Mar 4, 2019

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/

@addaleax addaleax 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
Member

BridgeAR commented Mar 5, 2019

@richardlau
Copy link
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.)

@BridgeAR BridgeAR 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
Member

addaleax commented Mar 5, 2019

@addaleax addaleax 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
Member

BridgeAR commented Mar 5, 2019

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

@addaleax
Copy link
Member

addaleax commented Mar 6, 2019

@BridgeAR
Copy link
Member

BridgeAR commented Mar 6, 2019

Landed in 53d4e04 🎉

@BridgeAR BridgeAR 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
Member

BridgeAR commented Mar 6, 2019

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
Contributor Author

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

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
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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants