You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs.cpSync() aborts the process when the destination is a dangling symlink #67141
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
It prints copied, and dest becomes a regular file, as on v24.22.2 and with fs.promises.cp().
What do you see instead?
The process aborts with exit code 134, and the catch block never runs:
terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
what(): filesystem error: cannot check file equivalence: No such file or directory [<dir>/src] [<dir>/dest]
Additional information
CpSyncCheckPaths in src/node_file.cc calls the throwing overload of std::filesystem::equivalent(src_path, dest_path). The function is the same in v24.22.2 and v25.0.0. The v24 release binary is built with GCC 12 and v25 with GCC 14, so the newer libstdc++ likely reports an error when only one of the two paths exists. I have a fix that uses the std::error_code overload, with a test, and will open a PR.
Activity
fs: fix cpSync() abort when dest is a dangling symlink
fs: fix cpSync() abort when dest is a dangling symlink
fs: fix cpSync() abort when dest is a dangling symlink
fs: fix cpSync() abort when dest is a dangling symlink