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

on Win10, fs.stat() returns a stats with undefined blksize and blocks #25913

Closed
3cp opened this issue Feb 4, 2019 · 2 comments · Fixed by #26056
Closed

on Win10, fs.stat() returns a stats with undefined blksize and blocks #25913

3cp opened this issue Feb 4, 2019 · 2 comments · Fixed by #26056
Labels
fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform.

Comments

@3cp
Copy link

3cp commented Feb 4, 2019

  • Version: 10.15.1, 10.14.1, 11.9.0
  • Platform: Windows10 64-bit (didn't test on other windows platform)
  • Subsystem: fs

On windows 10, blksize and blocks are undefined. This is a regression from v6 and v8 which are not affected.

As expected, both fs.stat() and fs.statSync() are affected.

This is easy to demo in a powershell.

> node
> var fs = require('fs');
> var s = fs.statSync('any-valid-file');
> s;
Stats {
  dev: 3759094541,
  mode: 33206,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: undefined,
  ino: 2814749767419687,
  size: 2526,
  blocks: undefined,
  atimeMs: 1549237516603.1382,
  mtimeMs: 1549237516603.1382,
  ctimeMs: 1549237516603.1382,
  birthtimeMs: 1549237516603.1382,
  atime: 2019-02-03T23:45:16.603Z,
  mtime: 2019-02-03T23:45:16.603Z,
  ctime: 2019-02-03T23:45:16.603Z,
  birthtime: 2019-02-03T23:45:16.603Z }
>
@bnoordhuis bnoordhuis added fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform. labels Feb 4, 2019
@bnoordhuis
Copy link
Member

@joyeecheung I think #20220 is responsible for this? blksize and blocks are passed up (or down, depending on how you look at it) from libuv to node_file.cc to getStatsFromBinding().

(Aside: blksize is fixed at 4096 in libuv but blocks is queried at runtime and meaningful.)

@richardlau
Copy link
Member

PR: #26056

richardlau added a commit to richardlau/node-1 that referenced this issue Feb 15, 2019
libuv returns values for `blksize` and `blocks` on stat calls so
do not coerce them into `undefined` on Windows.

PR-URL: nodejs#26056
Fixes: nodejs#25913
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this issue Feb 15, 2019
libuv returns values for `blksize` and `blocks` on stat calls so
do not coerce them into `undefined` on Windows.

PR-URL: #26056
Fixes: #25913
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
rvagg pushed a commit that referenced this issue Feb 28, 2019
libuv returns values for `blksize` and `blocks` on stat calls so
do not coerce them into `undefined` on Windows.

PR-URL: #26056
Fixes: #25913
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants