-
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
module: remove require('.') with NODE_PATH compat #3384
Conversation
Going to postpone this removal once more. This incompatibilty and the subsequent hack were added during io.js. the exposure time of this deprecation message would be quite short for users of 4.x. Likely target is 7.0.0. |
@silverwind ... is this still something you want to pursue? |
Yes, I'm just waiting for the v6 release so I can land this on master. |
7da4fd4
to
c7066fb
Compare
Mind elaborating on this change? Also, can we get a citgm run? |
06275b9
to
5cb631f
Compare
Rebased. When we introduced I introduced a 'hack' to restore the functionality with a deprecation message in place (#1363), which is now removed again. When this goes into the 7.0.0 release, the deprecation will have been in place for 1.5 years. |
Perhaps we should review the stability levels in the documentation first? |
Test is broken. Looks like something in ae18bbe made my "maintain backwards compat" section neccessary to resolve |
Condition fixed, new CI: https://ci.nodejs.org/job/node-test-pull-request/2468/ |
CI is green except an unrelated java failure. I don't think a CITGM would bring any more insights here because modules usually don't set |
@thealphanerd can you run this through a CITGM, just to be sure? |
Note that this change currently directly contradicts with the documentation, which says that only security, performance, or bug fixes will be accepted for Either the documentation should be fixed first, or this change rejected. |
lib/module.js
Outdated
if (request.charCodeAt(0) !== 46/*.*/ || ( | ||
request.charCodeAt(1) !== 46/*.*/ && | ||
request.charCodeAt(1) !== 47/*/*/ && | ||
request.length > 1)) { |
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.
@mscdex does this change look right to you? The condition was start !== '.' && start !== './' && start !== '..'
before you refactored it to use charCodeAt
. Tests are passing, but I'd like to get a second look on that one.
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.
You'll want to add appropriate request length checking before using charCodeAt(n)
to make sure you don't cause a deopt due to an out-of-bounds access.
While #6528 is still in limbo, I'd like to get this hack removed rather sooner than later. @nodejs/collaborators any concerns regarding the changes? (See #3384 (comment) for a summary) |
test/parallel/test-require-dot.js
Outdated
|
||
var c = require('.'); | ||
|
||
assert.equal(c.value, 42, 'require(".") should honor NODE_PATH'); |
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.
Instead of removing this test should we merely assert the opposite?
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.
Good idea!
Totally forgot about this one. I'll move it to the next milestone. |
+1 for option 2 |
I don't assume that a CITGM will catch anything here. The compat is just for users that set |
CI: https://ci.nodejs.org/job/node-test-pull-request/9878/ (For real now, couldn't start the last time because the CI was down) |
@nodejs/ctc ... please take a look at this and weigh in.
|
@jasnell done. I'll land this tomorrow if there are no objections. |
🎉 which Node version is this expected to land in? |
It's a major so it would land in 9.0.0 |
Finally landed in a517466. It's been a long ride. |
This removes the compatibilty code that was in place to allow an unintended interaction between `require('.')` and `NODE_PATH`. The compatibility code and the accompanying deprecation warning has been in place since 2015-04-17. PR-URL: #3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This removes the compatibilty code that was in place to allow an unintended interaction between `require('.')` and `NODE_PATH`. The compatibility code and the accompanying deprecation warning has been in place since 2015-04-17. PR-URL: nodejs/node#3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@nodejs/tsc it appears that this landed without running citgm and it is breaking a fairly insignificant portion of our ecosystem. It breaks a common use case of the module d specifically: require('d/lazy') A revert is incoming. If we had caught this earlier we may have been able to come up with a fix but with d receiving over 500k downloads a day I don't see how we can ship this tomorrow |
The original commit was landed without running CITGM. Unfortunately this change breaks the module `d` which has over 500k downloads a day. It is worth mentioning that the compatibility hack can be removed without breaking anything. We should definitely revisit for the next Semver-Major but shipping this today will cause non trivial ecosystem breakages. Refs: nodejs#3384
Some more details after a bit more research this commit specifically broke the case of requiring individual files in modules that only have a single character as a name. This will thankfully be limited to 26 cases! The specific line that broke things is a517466#diff-d1234a869b3d648ebfcdce5a76747d71L338 In light of this specific edge case we may want to re-examine the deprecation all together |
The original commit was landed without running CITGM. Unfortunately this change breaks the module `d` which has over 500k downloads a day. It is worth mentioning that the compatibility hack can be removed without breaking anything. We should definitely revisit for the next Semver-Major but shipping this today will cause non trivial ecosystem breakages. Refs: #3384 PR-URL: #16634 Refs: #3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The original commit was landed without running CITGM. Unfortunately this change breaks the module `d` which has over 500k downloads a day. It is worth mentioning that the compatibility hack can be removed without breaking anything. We should definitely revisit for the next Semver-Major but shipping this today will cause non trivial ecosystem breakages. Refs: #3384 PR-URL: #16634 Refs: #3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The original commit was landed without running CITGM. Unfortunately this change breaks the module `d` which has over 500k downloads a day. It is worth mentioning that the compatibility hack can be removed without breaking anything. We should definitely revisit for the next Semver-Major but shipping this today will cause non trivial ecosystem breakages. Refs: nodejs/node#3384 PR-URL: nodejs/node#16634 Refs: nodejs/node#3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The original commit was landed without running CITGM. Unfortunately this change breaks the module `d` which has over 500k downloads a day. It is worth mentioning that the compatibility hack can be removed without breaking anything. We should definitely revisit for the next Semver-Major but shipping this today will cause non trivial ecosystem breakages. Refs: nodejs/node#3384 PR-URL: nodejs/node#16634 Refs: nodejs/node#3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
The original commit was landed without running CITGM. Unfortunately this change breaks the module `d` which has over 500k downloads a day. It is worth mentioning that the compatibility hack can be removed without breaking anything. We should definitely revisit for the next Semver-Major but shipping this today will cause non trivial ecosystem breakages. Refs: nodejs/node#3384 PR-URL: nodejs/node#16634 Refs: nodejs/node#3384 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
In certain cases, `require('.')` could resolve outside the package directory. This behavior has been removed. PR-URL: nodejs#26973 Refs: nodejs#3384 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This PR replaces #1452. It's updated and targets
master
now. Adding 6.0.0 milestone as discussed.