mpifileutils icon indicating copy to clipboard operation
mpifileutils copied to clipboard

dcp and dsync: handle when destination link exists with different target

Open daltonbohning opened this issue 5 years ago • 2 comments

Example: If we have these links:

link1 -> file1
link2 -> file2

And run dsync like this:

dsync link1 dst
dsync link2 dst

Then we get:

dst -> file1

But dst -> file2 would be expected. Similarly, this happens when copying directories that contain links. This happens with both dcp and dsync.

daltonbohning avatar Oct 20 '20 17:10 daltonbohning

It doesn't seem there is a system call to update a link target. It seems the only way to update the target is to delete the destination before creating the symlink. That's what cp seems to do:

strace cp --no-dereference some_link existing_link
...
stat("existing_link"...
lstat("some_link"...
lstat("existing_link"...
unlink("existing_link"...
...
symlink(... "existing_link"...

daltonbohning avatar Oct 23 '20 00:10 daltonbohning

Hello,

Just updating the issue to say that I've been hit by this behavior. It would be nice to have it corrected of course ;)

In the meantime as a workaround, I'm using dfind --type l followed by drm before running dsync again.

jbd avatar Feb 03 '24 12:02 jbd