-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
filehandle.read(buffer) can't read file when options are omitted #47183
Comments
node/lib/internal/fs/promises.js Lines 569 to 571 in a94966f
It looks like the length is still zero here. length = buffer.byteLength - offset |
is this issue valid? please confirm. |
PR-URL: #51087 Fixes: #47183 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #51087 Fixes: #47183 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Edit: Oh, I see #51087 probably fixes this. Sorry for the noise! @pulkit-30 I can still reproduce this on node 21.5.0 and 20.10.0 with this script: import { open } from 'fs/promises';
async function main() {
const bytes = new Uint8Array(8);
const fileHandle = await open(process.argv[2]);
console.debug(await fileHandle.read(bytes));
}
main(); Invoked like this:
Produces this output:
|
PR-URL: #51087 Fixes: #47183 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Version
v18.12.1
Platform
Linux ubuntu-focal 5.4.0-144-generic #161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
https://nodejs.org/dist/latest-v18.x/docs/api/fs.html#filehandlereadbuffer-options
Even if you omit
options
, it will be default values.What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: