-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
path: fix basename() regressions #6590
Conversation
1979099
to
e3b43c0
Compare
@mscdex ... just for purposes of keeping track, was this related to the performance changes that landed in v5 or separate issue? (@nodejs/lts has been keeping an eye on the path changes and related regressions in case we decide to pull those in to v4 at some point) |
Unrelated build bot failure in CI (https://ci.nodejs.org/job/node-test-commit-arm/3146/nodes=armv8-ubuntu1404/console). LGTM otherwise. No specific comments on the commits. |
@jasnell Yes, this is fixing a regression from the |
assert.equal(path.basename('aaa/bbb', 'bbb'), 'bbb'); | ||
assert.equal(path.basename('aaa/bbb//', 'bbb'), 'bbb'); | ||
assert.equal(path.basename('aaa/bbb', 'bb'), 'b'); | ||
assert.equal(path.basename('aaa/bbb', 'b'), 'bb'); |
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.
maybe add a few tests for absolute paths with this case?
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've now added absolute versions of these tests, is that what you meant?
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 was thinking maybe something more like path.basename('/aaa/bbb')
since we have seen regressions for absolute vs relative paths. They may already be there though
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.
Ok, I've added that and a couple more.
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.
@evanlucas does this LGTY now?
b274124
to
f1595e1
Compare
LGTM if CI is happy |
assert.throws(path.win32.basename.bind(null, true), TypeError); | ||
assert.throws(path.win32.basename.bind(null, 1), TypeError); | ||
assert.throws(path.win32.basename.bind(null), TypeError); | ||
assert.throws(path.win32.basename.bind(null, {}), TypeError); |
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.
Just wondering, why were these tests removed?
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.
The TypeError checks are already done later on in the test file
for all path functions.
One last CI before landing, just in case: https://ci.nodejs.org/job/node-test-pull-request/2684/ |
f1595e1
to
f4a87ab
Compare
This commit fixes a regression in basename() for the case when a supplied extension name completely matches the resulting basename. Fixes: nodejs#6587 PR-URL: nodejs#6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
The TypeError checks are already done later on in the test file for all path functions. PR-URL: nodejs#6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
PR-URL: nodejs#6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
f4a87ab
to
27549f6
Compare
This commit fixes a regression in basename() for the case when a supplied extension name completely matches the resulting basename. Fixes: #6587 PR-URL: #6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
The TypeError checks are already done later on in the test file for all path functions. PR-URL: #6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
PR-URL: #6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
This commit fixes a regression in basename() for the case when a supplied extension name completely matches the resulting basename. Fixes: #6587 PR-URL: #6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
The TypeError checks are already done later on in the test file for all path functions. PR-URL: #6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
PR-URL: #6590 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Evan Lucas <[email protected]>
Checklist
Affected core subsystem(s)
Description of change
This commit fixes a regression in basename() for the case when a supplied extension name completely matches the resulting basename.
Fixes: #6587