cp
and cpSync
incorrectly handle existing dest symlinks
#58468
Labels
fs
Issues and PRs related to the fs subsystem / file system.
Uh oh!
There was an error while loading. Please reload this page.
Version
v24.1.0
Platform
Subsystem
fs
What steps will reproduce the bug?
Run the following code:
How often does it reproduce? Is there a required condition?
the issue can always be reproduced and it does not require a specific condition
What is the expected behavior? Why is that the expected behavior?
I believe that the second
cpSync
call should not throw any error, but the existing symlink files should be skipped unlessforce
is set tofalse
anderrorOnExist
istrue
, in such case anEEXIST
error should be thrown insteadWhat do you see instead?
The second
cpSync
call throws anERR_FS_CP_EINVAL
errorAdditional information
The
ERR_FS_CP_EINVAL
error is thrown even whenforce
is being used (and the dest file is not overridden).This applies both to
cp
andcpSync
`cp` reproduction
dereference
totrue
seems to fix the issue, however I am not sure if dereferencing is actually taking place since the symlinks are copied as such and not as the files they point to (which I think is the expected behavior? 🤔)The text was updated successfully, but these errors were encountered: