-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: streamline EISDIR error on different platforms #33831
Conversation
I know it’s far from ideal that we the introduction of our internal error system also meant mixing POSIX/libuv errors with our own error codes, but since we already have |
9a9e978
to
452fe61
Compare
@addaleax done. ping @nodejs/fs, this is ready for review. |
452fe61
to
696f18a
Compare
/cc @addaleax @jasnell @ronag the implementation changed slightly to handle backward slash on Windows. Also, anyone knows what can I do about test timeout on ARM? Should I separate these into a few tests? (On my machine the whole test takes less than a second though) Edit: now also handles fs.promises (forgot about them the previous time) |
Previously upon calling file-only fs functions with a directory (or presumably a directory of path ending with a forward slash '/') it would result in EISDIR error on Linux but Windows would completely ignore trailing '/' and perform operation on a file excluding it. This introduces additional checks in fs code to make sure the trailing slash is handled the same way across systems. Fixes: nodejs#17801
f85bc0d
to
0a9e6d8
Compare
22f316f
to
d9431eb
Compare
ping @addaleax @jasnell @ronag @nodejs/fs could this get another review since the implementation changed slightly and also I'd especially want to hear your opinion on this (is there a better way?) |
This needs a rebase. |
Ping @lundibundi |
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
Closing this because it has stalled. Feel free to reopen if this PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions. |
Fixes: nodejs#17801 Refs: nodejs#33831 PR-URL: nodejs#54160 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Fixes: nodejs#17801 Refs: nodejs#33831 PR-URL: nodejs#54160 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Previously upon calling file-only fs functions with a directory (or
presumably a directory of path ending with a forward slash '/') it would
result in EISDIR error on Linux but Windows would completely ignore trailing '/'
and perform operation on a file excluding it.
This introduces additional checks in fs code to make sure the trailing
slash is handled the same way across systems.
Fixes: #17801
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesThis currently adds checks in
readFile
/readFileSync
open
/openSync
truncate
/truncateSync
writeFile
/writeFileSync
readFile
/readFileSync
createReadStream
/createReadStreamSync
createWriteStream
/createWriteStreamSync
anything else I've missed?
/cc @nodejs/fs