Uh oh!
There was an error while loading. Please reload this page.
fs: optimize fs.cpSync js calls - #53614
Conversation
bebf131 to
2d5fb50Compareanonrig
commented
Jun 27, 2024
cc @nodejs/tsc @nodejs/fs appreciate your input on which path to take. previous pr:
this pr:
|
This comment was marked as outdated.
This comment was marked as outdated.
nodejs-github-bot
commented
Jul 8, 2024
nodejs-github-bot
commented
Jul 9, 2024
nodejs-github-bot
commented
Jul 9, 2024
nodejs-github-bot
commented
Jul 11, 2024
nodejs-github-bot
commented
Jul 12, 2024
nodejs-github-bot
commented
Jul 12, 2024
nodejs-github-bot
commented
Jul 16, 2024
aduh95
commented
Jul 16, 2024
Windows compilation is failing: |
anonrig
commented
Jul 17, 2024
@nodejs/platform-windows any idea why this build is failing? |
H4ad
commented
Jul 17, 2024
Building locally, I got this: |
StefanStojanovic
commented
Jul 17, 2024
This is also in the log from the CI. Based on the error message, this looks very similar to what we had in #53600 because std::filesystem::path::value_type is different on POSIX and Windows. |
This comment was marked as outdated.
This comment was marked as outdated.
anonrig
commented
Jul 21, 2024
It seems I forgot a |
nodejs-github-bot
commented
Jul 21, 2024
nodejs-github-bot
commented
Jul 22, 2024
nodejs-github-bot
commented
Jul 22, 2024
Landed in 88027e8 |
PR-URL: #53614 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #53614 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| ? std::filesystem::symlink_status(src_path, error_code) | ||
| : std::filesystem::status(src_path, error_code); | ||
| if (error_code) { | ||
| return env->ThrowUVException(EEXIST, "lstat", nullptr, src.out()); |
There was a problem hiding this comment.
This looks wrong, the error code should be properly translated instead of being directly mapped to EEXIST, there are many other reasons why this could fail.
| ToNamespacedPath(env, &src); | ||
| THROW_IF_INSUFFICIENT_PERMISSIONS( | ||
| env, permission::PermissionScope::kFileSystemRead, src.ToStringView()); | ||
| auto src_path = std::filesystem::path(src.ToStringView()); |
There was a problem hiding this comment.
BufferValue converts the string to UTF8, on Windows this requires automatic conversion for char8_t to work which may not be supported by the version of MSVC we use, I think that may be the source of bugs like #54476
There was a problem hiding this comment.
Actually no, this is simply broken on Windows, because this just gets returned in char. It needs to be returned as std::u8string/std::u8string_view instead.
#53612 is required to do a benchmark
A different approach to #53541
cc @nodejs/performance @nodejs/cpp-reviewers @billywhizz@jasnell @nodejs/fs
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1573/
Small win on happy path, and probably high win on error path: