hpc / mpifileutils

File utilities designed for scalability and performance.
https://hpc.github.io/mpifileutils
BSD 3-Clause "New" or "Revised" License
169 stars 68 forks source link

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

Open daltonbohning opened 4 years ago

daltonbohning commented 4 years ago

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 commented 4 years ago

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"...
jbd commented 9 months ago

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.