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

[Bug?]: filehandle.read(buffer, offset, length, position) broken using yarn node #4562

Closed
1 task
bbaa-bbaa opened this issue Jun 19, 2022 · 0 comments · Fixed by #3889
Closed
1 task

[Bug?]: filehandle.read(buffer, offset, length, position) broken using yarn node #4562

bbaa-bbaa opened this issue Jun 19, 2022 · 0 comments · Fixed by #3889
Labels
bug Something isn't working upholded Real issues without formal reproduction

Comments

@bbaa-bbaa
Copy link

bbaa-bbaa commented Jun 19, 2022

Self-service

  • I'd be willing to implement a fix

Describe the bug

The following code works if it is run as node bug.js, but fails if it is run as yarn node bug.js

const fs=require("fs");
(async function (){
  const Handle=await fs.promises.open("./test.txt","r");
  const Size=(await fs.promises.stat("./test.txt")).size;
  Handle.read(Buffer.alloc(Size),0,Size,0).then(({bytesRead,buffer})=>{
    console.log(bytesRead,buffer.toString("utf-8"))
  })
})()

To reproduce

const fs=require("fs");
await expect(async function (){
  fs.writeFileSync("test.txt","test")
  const Handle=await fs.promises.open("test.txt","r");
  const Size=(await fs.promises.stat("test.txt")).size;
  Handle.read(Buffer.alloc(Size),0,Size,0).then(({bytesRead,buffer})=>{
    console.log(bytesRead,buffer.toString("utf-8"))
  })
}()).resolves.toBeUndefined();

Environment

System:
  OS: Linux 5.18 Arch Linux
  CPU: (2) x64 Intel(R) Pentium(R) CPU G3260 @ 3.30GHz
Binaries:
  Node: 18.3.0 - /tmp/xfs-c94b87c2/node
  Yarn: 3.2.1 - /tmp/xfs-c94b87c2/yarn

Additional context

No response

@bbaa-bbaa bbaa-bbaa added the bug Something isn't working label Jun 19, 2022
@merceyz merceyz added the upholded Real issues without formal reproduction label Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upholded Real issues without formal reproduction
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants