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

bugfix #4884 On FreeBSD read(2) can read directories. Detect them before read. #8128

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

bugfix #4884 On FreeBSD read(2) can read directories. Detect them before read. #8128

wants to merge 2 commits into from

Conversation

madpilot78
Copy link

Summary

This is a fix for issue #4884 which shows up on FreeBSD and other OSes where it is possible to read(2) a directory (depending on the filesystem actually) and get back some binary representation of it.

This causes yarn to file as described in issue #4884.

In the FreeBSD ports tree we are installing yarn with another patch fundamentally backing out commit 2cb2fc4. This is suboptimal, also because we are patching the compiled bundle at present. Having a proper fix included upstream would be great.

I'll update the CHANGELOG in a new commit on this same pull request shortly.

Test plan

I tested it locally by checking that the same operations failing with a clean install are not happening with the new bundle.

…(2) a directory, getting some binary data representing it.

Code in yarn assumes the OS returns EISDIR when reading a directory. I added a fix which checks if the file is actually a directory before reading it, which should work everywhere.
@madpilot78
Copy link
Author

I'll update the CHANGELOG in a new commit on this same pull request shortly.

Actually this does not look necessary, since I'm not changing behavior.

When a directory is found, directly return an empty object instead of throwing an error causing the roundtrip through catch.
@madpilot78 madpilot78 changed the title On FreeBSD it is possible for a few filesystems (FFS and ZFS) to read… bugfix #4884 On FreeBSD it is possible for a few filesystems (FFS and ZFS) to read… May 16, 2020
@madpilot78 madpilot78 changed the title bugfix #4884 On FreeBSD it is possible for a few filesystems (FFS and ZFS) to read… bugfix #4884 On FreeBSD read(2) can read directories. Detect them before read. May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant