-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
lib: include cached modules in module.children #14132
Conversation
@@ -0,0 +1,5 @@ | |||
'use strict'; | |||
require('sys'); // Builtin should not show up in module.children array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I picked a module that's unlikely to have already been included by test/common.js.
Worth a CitGM run: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/899/ |
Does this mean that a structure |
@Slayer95 Yes, there can be cycles now. (That's the reason for the changes to test/sequential/test-module-loading.js: it didn't handle them.) |
const common = require('../common'); | ||
const assert = require('assert'); | ||
|
||
const dir = common.fixturesDir + '/GH-7131'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.join()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mwah, I can change that if you feel strongly but we have a gazillion tests that use simple string concatenation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer it. Updating the remaining ones for consistency would be a good Code-and-Learn activity (ping @nodejs/codeandlearn)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure since https://nodejs.org/api/modules.html#modules_all_together (module names are URL like)
Maybe path.posix.join
, but I'm +1 on literal /
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@refack to be clear, you're saying that path.join()
is wrong because it'll resolve to a\\b
on Windows, and require always takes a POSIX style path (a/b
)?
I'd rather have a concatenation (or `${common.fixturesDir}/GH-7131`
) than path.posix.join
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@refack to be clear, you're saying that path.join() is wrong because it'll resolve to a\b on Windows, and require always takes a POSIX style path (a/b)?
Not wrong per se, just less right.
|
||
const dir = common.fixturesDir + '/GH-7131'; | ||
const b = require(dir + '/b'); | ||
const a = require(dir + '/a'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.join()
?
path.join() nits included, new CI: https://ci.nodejs.org/job/node-test-pull-request/9202/ |
I have to kill the ARM job https://ci.nodejs.org/job/node-test-binary-arm/9302/ It was Green (yellow) but wasn't reporting that it finished upstream. |
CI appears to be having some issues right now |
FWIW https://ci.nodejs.org/job/node-test-binary-arm/9302/ was green, except for a flake in freeBSD. And currently CI is even flakier then last night. |
@refack Are you saying that the whole run was green (except for a flake), not just the ARM machines? The node-test-binary-arm in the URL threw me off. |
Yes. Whole run was green. |
`module.children` is supposed to be the list of modules included by this module but lib/module.js failed to update the list when the included module was retrieved from `Module._cache`. Fixes: nodejs#7131 PR-URL: nodejs#14132 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
`module.children` is supposed to be the list of modules included by this module but lib/module.js failed to update the list when the included module was retrieved from `Module._cache`. Fixes: #7131 PR-URL: #14132 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
@bnoordhuis should this be backported to LTS? if so how far back? edit: considering this broke some stuff in the wild it might be best to just leave it out... at least of v4.x |
Matchmaker is now globally accessible under Ladders, rather than needing to be manually required. This fixes a crash when hotpatching certain things.
Confirming that this did break stuff at least for our project, which had to be dealt with using a global state-based quick&dirty fix. |
@nodejs/tsc |
ping @nodejs/tsc and @nodejs/lts one more time |
-1 in backporting |
It's breaking this too. because of this . https://github.com/krakenjs/freshy/blob/master/index.js#L85 |
module.children
is supposed to be the list of modules included by thismodule but lib/module.js failed to update the list when the included
module was retrieved from
Module._cache
.Fixes: #7131
CI: https://ci.nodejs.org/job/node-test-pull-request/9038/