Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symlinks support allow to create duplicate named files when moving #8245

Open
pasnox opened this issue Dec 14, 2024 · 0 comments
Open

symlinks support allow to create duplicate named files when moving #8245

pasnox opened this issue Dec 14, 2024 · 0 comments

Comments

@pasnox
Copy link
Contributor

pasnox commented Dec 14, 2024

Recently symlinks support in master comes with a broken move support.
It allow to copy different files that would be seen identical (regular file.ext and symlink file.ext.rclonelink) into the same folder.
See #6337 (comment)

There are test cases for these which are currently skipped.

  • rclone/vfs/vfstest/file.go

    Lines 235 to 237 in 0988fd9

    // Move symlink -> regular file
    t.Run("MoveSymlinkToFile", func(t *testing.T) {
    t.Skip("FIXME not implemented")
  • rclone/vfs/vfstest/file.go

    Lines 252 to 254 in 0988fd9

    // Move regular file -> symlink
    t.Run("MoveFileToSymlink", func(t *testing.T) {
    t.Skip("FIXME not implemented")
  • rclone/vfs/vfstest/file.go

    Lines 269 to 271 in 0988fd9

    // Move symlink -> directory
    t.Run("MoveSymlinkToDirectory", func(t *testing.T) {
    t.Skip("FIXME not implemented")
  • rclone/vfs/vfstest/file.go

    Lines 286 to 288 in 0988fd9

    // Move directory -> symlink
    t.Run("MoveDirectoryToSymlink", func(t *testing.T) {
    t.Skip("FIXME not implemented")

When done, remove the caveat in the docs added by 0ce2e12

Demo (by ncw)

mkdir /tmp/src
rclone -vv mount --vfs-links /tmp/src/ /mnt/tmp/

Then this - looks fine

$ touch /mnt/tmp/source
$ ln -s source /mnt/tmp/symlink
$ ls -l /mnt/tmp/

total 1
-rw-rw-r-- 1 ncw ncw 0 Dec 16 10:40 source
lrw-rw-r-- 1 ncw ncw 6 Dec 16 10:40 symlink -> source

The underlying remote looks OK too

$ ls -l /tmp/src/
total 4
-rw-rw-r-- 1 ncw ncw 0 Dec 16 10:40 source
-rw-rw-r-- 1 ncw ncw 6 Dec 16 10:40 symlink.rclonelink

Now create a file with the same name

$ touch /mnt/tmp/file2
$ mv /mnt/tmp/file2 /mnt/tmp/symlink 
$ ls -l /mnt/tmp/
total 0
-rw-rw-r-- 1 ncw ncw 0 Dec 16 10:40 source
-rw-rw-r-- 1 ncw ncw 0 Dec 16 10:41 symlink

BUT this has created a duplicate file in the underlying remote - the symlink should have been overwritten by the file.

$ ls -l /tmp/src/
total 4
-rw-rw-r-- 1 ncw ncw 0 Dec 16 10:40 source
-rw-rw-r-- 1 ncw ncw 0 Dec 16 10:41 symlink
-rw-rw-r-- 1 ncw ncw 6 Dec 16 10:40 symlink.rclonelink
@ncw ncw added this to the v1.70 milestone Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants