Skip to content

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

Open

Description

@pasnox

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

Activity

  1. added this to the v1.70 milestone on Dec 16, 2024
  2. modified the milestones: v1.70, v1.71 on Jun 19, 2025
  3. modified the milestones: v1.71, v1.72 on Sep 4, 2025
  4. modified the milestones: v1.72, v1.73 on Nov 24, 2025
  5. modified the milestones: v1.73, v1.74 on Feb 17, 2026
  6. modified the milestones: v1.74, v1.75 on May 5, 2026
  7. eyupcanakman commented on May 20, 2026

    @eyupcanakman

    I'd like to take this one.

    I un-skipped the four corner case #3 tests in vfs/vfstest/file.go and they fail the way you'd expect, the move returns no error and the backend keeps both name and name.rclonelink. The other symlink cases pass.

    Before I write the fix, one thing. The demo says overwrite, but those four tests all assert.Error, same as the create cases #1 and #2. I'll go with reject, return EEXIST from Dir.Rename like Dir.Create and Dir.Mkdir do, then un-skip the tests and remove the docs caveat from 0ce2e12. Shout if you'd rather it overwrite.

  8. ncw commented on May 20, 2026

    @ncw
    Member

    @eyupcanakman I think overwrite or error is both fine whichever causes the least mess in the code! Go for it :-)

  9. modified the milestones: v1.75, v1.76, v1.77 on Nov 3, 2026
  10. added a commit that references this issue on Nov 12, 2026
    b4f6a86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions