Sitelet https://github.com/nodejs/node/issues/40006
Skip to content

fs.fstat(0) fails on Windows #40006

Description

@targos

Version

master,v16.8.0

Platform

Microsoft Windows NT 10.0.22000.0 x64 (latest Windows 11 beta)

Subsystem

fs

What steps will reproduce the bug?

Run node test/parallel/test-fs-stat.js

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

Test should pass

What do you see instead?

node test/parallel/test-fs-stat.js
node:assert:986
throw newErr;
^

AssertionError [ERR_ASSERTION]: ifError got unwanted exception: EISDIR: illegal operation on a directory, fstat
    at D:\Git\nodejs\node\test\common\index.js:364:12
    at D:\Git\nodejs\node\test\common\index.js:401:15
    at FSReqCallback.oncomplete (node:fs:198:21)
 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: [Error: EISDIR: illegal operation on a directory, fstat] {
    errno: -4068,
    code: 'EISDIR',
    syscall: 'fstat'
  },
  expected: null,
  operator: 'ifError'
}

Additional information

Fails here:

fs.fstat(-0, common.mustSucceed());

Activity

  1. added
    fsIssues and PRs related to file-system APIs and the fs module.
    testIssues and PRs related to Node.js core tests and test infrastructure.
    windowsIssues and PRs related to the Windows platform.
    on Sep 5, 2021
  2. targos commented on Sep 5, 2021

    @targos
    MemberAuthor

    It can be easily reproduced with the following script:

    require('fs').fstatSync(0)
  3. changed the title [-]test-fs-stat fails on Windows[/-] [+]fs.fstat(0) fails on Windows[/+] on Sep 5, 2021
  4. targos commented on Nov 18, 2021

    @targos
    MemberAuthor

    @nodejs/platform-windows This is still an issue on my machine.

  5. StefanStojanovic commented on Nov 30, 2022

    @StefanStojanovic
    Contributor

    The fix for this landed in libuv libuv/libuv#3811. The next time libuv is updated Node will be fixed as well.

  6. StefanStojanovic commented on Jun 7, 2023

    @StefanStojanovic
    Contributor

    After updating libuv to 1.45.0 this is fixed. @targos can you please close the issue? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to file-system APIs and the fs module.testIssues and PRs related to Node.js core tests and test infrastructure.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions