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

fs.readFile[Sync]("/dev/stdin") does not always read the entire file #1070

Closed
piscisaureus opened this issue Mar 5, 2015 · 1 comment
Closed
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system.

Comments

@piscisaureus
Copy link
Contributor

Originally reported here: nodejs/node-v0.x-archive#7412

The root cause of the issue is that fs.readFile() stats the file and reads the amount of bytes specified in the st_size field. This works only for regular files.

The fix would be to check whether the ST_IFREG flag is set. If not, use a slower but more reliable method to read the entire file.

I think this is a "good first bug" for new contributors.

@piscisaureus piscisaureus added confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system. labels Mar 5, 2015
@brendanashworth
Copy link
Contributor

I think this should be fixed in #1074, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests

2 participants