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

fs: improve mode and flags validation #27044

Closed
wants to merge 3 commits into from

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Apr 1, 2019

This fixes a bug in fs.promises.access as it accepted strings as
mode. It should have only accepted numbers. It will now always
validate the flags and the mode argument in an consistent way.

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

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Apr 1, 2019
@BridgeAR
Copy link
Member Author

BridgeAR commented Apr 2, 2019

This mainly fixes the bug but I mark this defensively as semver-major.

CITGM https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1791/

@BridgeAR BridgeAR added the semver-major PRs that contain breaking changes and should be released in the next major version. label Apr 2, 2019
@BridgeAR
Copy link
Member Author

BridgeAR commented Apr 3, 2019

@nodejs/fs @nodejs/tsc PTAL

@nodejs-github-bot

This comment has been minimized.

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 3, 2019
@nodejs-github-bot

This comment has been minimized.

@BridgeAR
Copy link
Member Author

BridgeAR commented Apr 5, 2019

@nodejs/fs @nodejs/tsc PTAL

@nodejs-github-bot

This comment has been minimized.

@BridgeAR
Copy link
Member Author

BridgeAR commented Apr 8, 2019

This already has some LGs but it needs one more LG from the @nodejs/tsc. PTAL

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

Would you mind adding some more tests to cover the changes in fs? I don't see new tests, I only see one test removed.

@BridgeAR BridgeAR added wip Issues and PRs that are still a work in progress. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Apr 9, 2019
@BridgeAR BridgeAR removed the wip Issues and PRs that are still a work in progress. label Sep 26, 2019
@BridgeAR
Copy link
Member Author

I finally got the time to get back to this. The last time I missed a few more bugs in the beginning. That was very subtle because the name of the arguments was deceiving me. I fixed the variable naming and added proper validation for copyFile. I also added a couple more tests.

PTAL

@BridgeAR BridgeAR added the review wanted PRs that need reviews. label Sep 26, 2019
@BridgeAR
Copy link
Member Author

I just pushed two more commits that add some more refinements to the docs and fix all left issues with mode and flag.

@nodejs-github-bot

This comment has been minimized.

@BridgeAR
Copy link
Member Author

@jasnell @targos @Trott @bnoordhuis please confirm your LG so that this can land.

@BridgeAR
Copy link
Member Author

BridgeAR commented Dec 19, 2019

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

Multiple `fs` functions have a `mode` and or `flag` option. In some
cases those have been mistaken and named wrongly. All of those faulty
entries have been fixed.
Besides that some indentation is also aligned with the rest of the
document.
This fixes a few bugs in `fs`. E.g., `fs.promises.access` accepted
strings as mode. It should have only accepted numbers. It will now
always validate the flags and the mode argument in an consistent way.
This consolidates some examples to concentrate the reader on the
important aspects and to reduce reading overhead.
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jan 11, 2020

@BridgeAR
Copy link
Member Author

@jasnell @targos @Trott @bnoordhuis please confirm your LG so that this can land.
This PR is open for quite some while.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@BridgeAR BridgeAR added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed review wanted PRs that need reviews. labels Jan 12, 2020
BridgeAR added a commit that referenced this pull request Jan 12, 2020
Multiple `fs` functions have a `mode` and or `flag` option. In some
cases those have been mistaken and named wrongly. All of those faulty
entries have been fixed.
Besides that some indentation is also aligned with the rest of the
document.

PR-URL: #27044
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
BridgeAR added a commit that referenced this pull request Jan 12, 2020
This fixes a few bugs in `fs`. E.g., `fs.promises.access` accepted
strings as mode. It should have only accepted numbers. It will now
always validate the flags and the mode argument in an consistent way.

PR-URL: #27044
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
BridgeAR added a commit that referenced this pull request Jan 12, 2020
This consolidates some examples to concentrate the reader on the
important aspects and to reduce reading overhead.

PR-URL: #27044
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@BridgeAR
Copy link
Member Author

Landed in af5ddf2...4455f60 🎉

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. 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.

9 participants