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

fs: use consistent defaults in sync stat functions by cjihrig · Pull Request #31097 · nodejs/node · GitHub

/ node Public

fs: use consistent defaults in sync stat functions - #31097

Closed
cjihrig wants to merge 1 commit into
nodejs:masterfrom
cjihrig:stat-defaults
Closed

fs: use consistent defaults in sync stat functions#31097
cjihrig wants to merge 1 commit into
nodejs:masterfrom
cjihrig:stat-defaults

Conversation

cjihrig commented Dec 26, 2019

Copy link
Copy Markdown
Contributor

This commit updates the default options used by statSync(), lstatSync(), and fstatSync() to be identical to the defaults used by the callback- and Promise-based versions.

Technically, the binding layer treats bigint values of undefined and false the same, but we might as well be consistent.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

This commit updates the default options used by statSync(),
lstatSync(), and fstatSync() to be identical to the defaults
used by the callback- and Promise-based versions.
nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Dec 26, 2019

devsnek 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

this means that xyz(path, {}) will still have options.bigint be undefined. we may want to explore defaults further in future changes.

Comment thread lib/fs.js
function fstatSync(fd, options = { bigint: false }) {
validateInt32(fd, 'fd', 0);
const ctx = { fd };
const stats = binding.fstat(fd, options.bigint, undefined, ctx);

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

For @devsnek 's concerns, how about changing this to:

Suggested change
const stats = binding.fstat(fd, options.bigint, undefined, ctx);
const stats = binding.fstat(fd, options.bigint || false, undefined, ctx);

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

in a future change we could do { bigint = false } = {} for all of them

addaleax added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Dec 28, 2019

nodejs-github-bot commented Dec 28, 2019
edited by cjihrig
Loading

Copy link
Copy Markdown
Collaborator

Trott commented Dec 29, 2019

Copy link
Copy Markdown
Member

Landed in 3cd7780

Trott closed this Dec 29, 2019
Trott pushed a commit that referenced this pull request Dec 29, 2019
This commit updates the default options used by statSync(),
lstatSync(), and fstatSync() to be identical to the defaults
used by the callback- and Promise-based versions.

PR-URL: #31097
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
cjihrig deleted the stat-defaults branch December 29, 2019 15:47
BridgeAR pushed a commit that referenced this pull request Jan 3, 2020
This commit updates the default options used by statSync(),
lstatSync(), and fstatSync() to be identical to the defaults
used by the callback- and Promise-based versions.

PR-URL: #31097
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
BridgeAR mentioned this pull request Jan 7, 2020
targos pushed a commit that referenced this pull request Jan 14, 2020
This commit updates the default options used by statSync(),
lstatSync(), and fstatSync() to be identical to the defaults
used by the callback- and Promise-based versions.

PR-URL: #31097
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
This commit updates the default options used by statSync(),
lstatSync(), and fstatSync() to be identical to the defaults
used by the callback- and Promise-based versions.

PR-URL: #31097
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
MylesBorins mentioned this pull request Feb 8, 2020
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

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. fs Issues and PRs related to the fs subsystem / file system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL