symlinks support allow to create duplicate named files when moving
Nobody has claimed this yet.
- 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.
- https://github.com/rclone/rclone/blob/0988fd9e9f77a29bd5344c0c1862d6b5e4a763e7/vfs/vfstest/file.go#L235-L237
- https://github.com/rclone/rclone/blob/0988fd9e9f77a29bd5344c0c1862d6b5e4a763e7/vfs/vfstest/file.go#L252-L254
- https://github.com/rclone/rclone/blob/0988fd9e9f77a29bd5344c0c1862d6b5e4a763e7/vfs/vfstest/file.go#L269-L271
- https://github.com/rclone/rclone/blob/0988fd9e9f77a29bd5344c0c1862d6b5e4a763e7/vfs/vfstest/file.go#L286-L288
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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