FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fs: fix fs.readFile, fs.exists{Sync} regression caused by assertions by joyeecheung · Pull Request #17852 · nodejs/node · GitHub

/ node Public

fs: fix fs.readFile, fs.exists{Sync} regression caused by assertions - #17852

Closed
joyeecheung wants to merge 2 commits into
nodejs:masterfrom
joyeecheung:fix-fs-assertion
Closed

fs: fix fs.readFile, fs.exists{Sync} regression caused by assertions#17852
joyeecheung wants to merge 2 commits into
nodejs:masterfrom
joyeecheung:fix-fs-assertion

Conversation

Copy link
Copy Markdown
Member
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

fs

Refs: #17667

#17667 didn't include the path validation of these methods in JS land, so passing undefined as paths to them would go straight to assertions, which caused CITGM regression https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1165/ . This PR fixes that by adding those validations back.

nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Dec 24, 2017

joyeecheung commented Dec 24, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

joyeecheung added the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 24, 2017
Comment thread lib/fs.js
fs.exists = function(path, callback) {
if (handleError((path = getPathFromURL(path)), cb))
return;
if (typeof path !== 'string' && !(path instanceof Buffer)) {

starkwang Dec 25, 2017
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should these type checks be placed at the beginning of these methods?

Trott Dec 25, 2017
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@starkwang No because the check must happen after getPathFromURL(path) is called. The path may be a string, a Buffer, or a URL-like object.

joyeecheung commented Dec 26, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

joyeecheung added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. dont-land-on-v4.x and removed semver-major PRs that contain breaking changes and should be released in the next major version. labels Dec 27, 2017

joyeecheung commented Dec 27, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

This is not semver-major itself, it just fixes regressions in #17667 which is semver-major. So added dont land labels instead.

joyeecheung commented Dec 27, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

:/ ... ah, right, technically speaking the previous behavior is "throwing old-style type errors", so this is still semver-major. @nodejs/tsc this needs one more TSC approval to land, please review

joyeecheung added semver-major PRs that contain breaking changes and should be released in the next major version. and removed dont-land-on-v4.x author ready PRs that have at least one approval, no outstanding review comments, and a CI started. labels Dec 27, 2017

mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

Copy link
Copy Markdown
Contributor

Landed in 9ec700b and 71396a2

🎉

apapirovski pushed a commit that referenced this pull request Dec 27, 2017
PR-URL: #17852
Refs: #17667
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
apapirovski pushed a commit that referenced this pull request Dec 27, 2017
PR-URL: #17852
Refs: #17667
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fs Issues and PRs related to the fs subsystem / file system. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL