rclone / rclone/rclone

symlinks support allow to create duplicate named files when moving

Open
#8,245 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug VFS / mount
Dominant language
Go
Stars
59.8k
Forks
5.4k
Avg merge
2d 14h
Merged PRs (30d)
48

Description

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 https://github.com/rclone/rclone/pull/6337#issuecomment-2542534051

There are test cases for these which are currently skipped.

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

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the skipped test cases in vfs/vfstest/file.go at the four referenced locations and reproduce the move scenario from the issue. Trace the VFS move behavior for a regular file and a .rclonelink symlink, then re-enable the cases and run the relevant tests. Done means the destination name replaces the symlink without leaving both remote entries, and the documentation caveat from commit 0ce2e12d9f3f6e79661cea0783cc6cfdeb848386 is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.