-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: fix readdir and opendir recursive with unknown file types #49603
Conversation
If the libuv operations invoked by `readdir`/`opendir` return `uv_dirent_t` values where the `type` is `UV_DIRENT_UNKNOWN` then a further `lstat` is issued to fully construct the `Dirent` values. In the recursive versions of these functions, the `path` parameter was incorrectly assumed to be the path to the entry when it should be the path to the directory containing the entry. Fixes #49499.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Great investigation and fix @lux01 . Thank you very much! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@ruyadorno this seems like a serious bug and is ready for landing, perhaps it is a good idea to land this into v18? |
Fast-track has been requested by @MoLow. Please 👍 to approve. |
To fix this on the |
Landed in d8b378c |
@MoLow it hasn't landed on time yet for the v20 release and I prefer not to rush it to v18 before it's out in a current release line. 😊 thanks for the heads up though! |
If the libuv operations invoked by `readdir`/`opendir` return `uv_dirent_t` values where the `type` is `UV_DIRENT_UNKNOWN` then a further `lstat` is issued to fully construct the `Dirent` values. In the recursive versions of these functions, the `path` parameter was incorrectly assumed to be the path to the entry when it should be the path to the directory containing the entry. Fixes #49499. PR-URL: #49603 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
If the libuv operations invoked by `readdir`/`opendir` return `uv_dirent_t` values where the `type` is `UV_DIRENT_UNKNOWN` then a further `lstat` is issued to fully construct the `Dirent` values. In the recursive versions of these functions, the `path` parameter was incorrectly assumed to be the path to the entry when it should be the path to the directory containing the entry. Fixes nodejs#49499. PR-URL: nodejs#49603 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
This introduced a breaking change for |
An error occurred in the test/sequential/test-fs-opendir-recursive.js file after changing the code. This was resolved by referring to the code resolved in PR nodejs#49603. Refs: nodejs#49603
An error occurred in the test/sequential/test-fs-opendir-recursive.js file after changing the code. This was resolved by referring to the code resolved in PR nodejs#49603. Refs: nodejs#49603
An error occurred in the test/sequential/test-fs-opendir-recursive.js file after changing the code. This was resolved by referring to the code resolved in PR nodejs#49603. Refs: nodejs#49603
If the libuv operations invoked by
readdir
/opendir
returnuv_dirent_t
values where thetype
isUV_DIRENT_UNKNOWN
then a furtherlstat
is issued to fully construct theDirent
values. In the recursive versions of these functions, thepath
parameter was incorrectly assumed to be the path to the entry when it should be the path to the directory containing the entry.Fixes #49499.