-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
Description
- Version: 7.6.0
- Platform: Windows 7 x64
- Subsystem: fs, test
1. fs.appendFile() and fs.writeFile() can be called without mandatory data parameter, while not throwing any error messages. Thus, the only second parameter serves as data and callback (mandatory as well) parameters at the same time.
const fs = require('fs');
const cb = (err) => { if(err) console.error(err); }
fs.appendFile('append-file.txt', cb);
fs.writeFile('write-file.txt', cb);This code runs without any errors and produces 2 files with the same content:
> cat append-file.txt
(err) => { if(err) console.error(err); }
> cat write-file.txt
(err) => { if(err) console.error(err); }
It seems this is hardly an expected behavior.
2. test/parallel/test-fs-null-bytes.js tests these functions with wrong parameters scheme, i.e. without mandatory data parameter. This may be not very important for the test aim, but it makes it somehow compromised.
seishunsam-github
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.