Skip to content

Regression in fs.readFile  #55609

Description

@alexander-akait

Version

v23.1.0

Platform

Linux akait-notebook 6.8.0-47-generic #47-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 21:40:26 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

const fs = require("fs");

fs.readFile("/", err => {
	console.log(err);
});

fs.readFile("/", err => {
	console.log(err);
});

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

Always

What is the expected behavior? Why is that the expected behavior?

Like in Node.js@22, each callback should be run with err and code should be EISDIR

What do you see instead?

The call happens only once for the first call and the callbacks are not called instead an error is thrown like for sync function

Additional information

Ref: webpack/webpack#18891

Activity

  1. added
    fsIssues and PRs related to file-system APIs and the fs module.
    on Oct 30, 2024
  2. avivkeller commented on Oct 30, 2024

    @avivkeller
    Member

    The call happens only once for the first call and the callbacks are not called instead an error is thrown like for sync function

    AFAICT this is not the case. While I'm able to reproduce the issue, no call appears to use the callback, and an error is thrown.

    This is because getValidatedPath does not return the error to the callback, but instead throws it.

  3. alexander-akait commented on Oct 30, 2024

    @alexander-akait
    Author

    @redyetidev In our case, we often call this function with /, the second call does not even throw an error, so try/catch doesn't help in this case

  4. juanarbol commented on Oct 31, 2024

    @juanarbol
    Member

    I'll bisect.

  5. juanarbol commented on Oct 31, 2024

    @juanarbol
    Member

    Same in macos

  6. juanarbol commented on Oct 31, 2024

    @juanarbol
    Member
  7. juanarbol commented on Nov 3, 2024

    @juanarbol
    Member

    The regression is reverted, I'm closing this issue.

  8. snitin315 commented on Nov 3, 2024

    @snitin315
    Contributor

    @juanarbol When will be the patch released?

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

    confirmed-bugIssues and PRs for confirmed bugs.fsIssues and PRs related to file-system APIs and the fs module.regressionIssues related to regressions.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions