-
Notifications
You must be signed in to change notification settings - Fork 30k
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: expose realpath(3) bindings #15776
Conversation
cleanup(); | ||
} | ||
setup(); | ||
common.refreshTmpDir(); |
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.
It gets somewhat lost in the noise but this is a bug fix: the fs.rmdirSync()
logic didn't work because a/
contains more than just a/b
. It didn't result in actual failures because the test runner cleans it up afterwards.
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.
Think this is worth documenting. With this addition I imagine that if there are other native fs functions people want they'll request something similar (though I'm not sure what those would be).
I'm happy with this approach. |
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 but needs docs
I wrought documentation, PTAL. Rebase + new CI: https://ci.nodejs.org/job/node-test-pull-request/11282/ |
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 with docs. Thanks @bnoordhuis
Make the `uv_fs_realpath()` binding (which calls the libc `realpath()` on UNIX and `GetFinalPathNameByHandle()` on Windows) available as the `fs.realpath.native()` and `fs.realpathSync.native()` functions. The binding was already available as `process.binding('fs').realpath` but was not exposed or tested - and partly broken as a result. Fixes: nodejs#8715 PR-URL: nodejs#15776 Refs: nodejs#7899 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
Landed in 74023c0. The one CI failure was a known problematic test on AIX. |
Make the `uv_fs_realpath()` binding (which calls the libc `realpath()` on UNIX and `GetFinalPathNameByHandle()` on Windows) available as the `fs.realpath.native()` and `fs.realpathSync.native()` functions. The binding was already available as `process.binding('fs').realpath` but was not exposed or tested - and partly broken as a result. Fixes: #8715 PR-URL: #15776 Refs: #7899 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
Where are the docs? Ctrl+Fing https://nodejs.org/api/fs.html for "native" turns up nothing. |
@bnoordhuis ^^^ |
Mea culpa, somehow I managed to drop the documentation commit while merging the pull request. This should have been included in commit 74023c0 ("fs: expose realpath(3) bindings") from this month. PR-URL: nodejs#17059 Refs: nodejs#15776 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Back-porters, this should land together with the documentation from #17059. |
Hiya, this completely breaks Jest with the following trace:
Should I create a new issue? Simple repro can be seen in issue jestjs/jest#5030, but also on jest's own code base. |
Completely minimal reproduction is: |
Is Jest using |
It is indeed. PR on the way. EDIT: jestjs/jest#5031 |
Looks like
|
It only happens on the beta releases of jest, not on the version marked Would be ideal to use the function added in this PR, but we still have to support older versions of node. |
Mea culpa, somehow I managed to drop the documentation commit while merging the pull request. This should have been included in commit 74023c0 ("fs: expose realpath(3) bindings") from this month. PR-URL: #17059 Refs: #15776 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Release team were -1 on landing on 6.x, but +1 on reconsidering for the next 8.x minor. |
Choosing not to land this on 8.x right now as it had earlier broken jest and could cause similar unexpected breakages. Someone should feel open to change labels / open a PR if they feel otherwise |
quick ping to ensure no one wants to see this backported |
Make the
uv_fs_realpath()
binding (which calls the libcrealpath()
on UNIX and
GetFinalPathNameByHandle()
on Windows) available as thefs.realpath.native()
andfs.realpathSync.native()
functions.The binding was already available as
process.binding('fs').realpath
but was not exposed or tested - and partly broken as a result.
Fixes: #8715
Refs: #7899
CI: https://ci.nodejs.org/job/node-test-pull-request/10411/
If we don't go down this, ah, path, we should just remove the method from
src/node_file.cc
.edit: forgot to mention: no documentation just yet because that would be wasted effort if everyone hates this.