Local-to-local with --links --metadata and no retries gives errors

What is the problem you are having with rclone?

When doing the following:

  • Local-to-local
  • --link
  • --metadata
  • No retries (more on this later)

you get an error. This also happens in the rc interface but I isolated it to the CLI to be more easy to reproduce.

Note that it still works though gives an error. This is a false flag on the CLI but can be a real problem on the RC interface since it errors.

Run the command 'rclone version' and share the full output of the command.

rclone v1.66.0
- os/version: darwin 14.4.1 (64 bit)
- os/kernel: 23.4.0 (arm64)
- os/type: darwin
- os/arch: arm64 (ARMv8 compatible)
- go/version: go1.22.1
- go/linking: dynamic
- go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

local

The command you were trying to run (eg rclone copy /tmp remote:tmp)

Consider the following:

.
└── src
    ├── file1.txt
    └── link1.txt -> file1.txt

The command is

rclone copy \
    "src" \
    "dst" \
    -vv --links --metadata --retries 1

The rclone config contents with secrets removed.

N/A -- on-the-fly local

A log from the command with the -vv flag

2024/04/27 15:32:21 DEBUG : Setting --config "" from environment variable RCLONE_CONFIG=""
2024/04/27 15:32:21 DEBUG : rclone: Version "v1.66.0" starting with parameters ["rclone" "copy" "src" "dst" "-vv" "--links" "--metadata" "--retries" "1"]
2024/04/27 15:32:21 DEBUG : Creating backend with remote "src"
2024/04/27 15:32:21 DEBUG : Using config file from ""
2024/04/27 15:32:21 DEBUG : local: detected overridden config - adding "{b6816}" suffix to name
2024/04/27 15:32:21 DEBUG : fs cache: renaming cache item "src" to be canonical "local{b6816}:/Volumes/RAMdisk/demo/src"
2024/04/27 15:32:21 DEBUG : Creating backend with remote "dst"
2024/04/27 15:32:21 DEBUG : local: detected overridden config - adding "{b6816}" suffix to name
2024/04/27 15:32:21 DEBUG : fs cache: renaming cache item "dst" to be canonical "local{b6816}:/Volumes/RAMdisk/demo/dst"
2024/04/27 15:32:21 DEBUG : file1.txt: Need to transfer - File not found at Destination
2024/04/27 15:32:21 DEBUG : link1.txt.rclonelink: Need to transfer - File not found at Destination
2024/04/27 15:32:21 DEBUG : Local file system at /Volumes/RAMdisk/demo/dst: Waiting for checks to finish
2024/04/27 15:32:21 DEBUG : Local file system at /Volumes/RAMdisk/demo/dst: Waiting for transfers to finish
2024/04/27 15:32:21 ERROR : link1.txt.rclonelink: Failed to copy: failed to set metadata: failed to change permissions: chmod /Volumes/RAMdisk/demo/dst/link1.txt: no such file or directory
2024/04/27 15:32:21 DEBUG : file1.txt: md5 = e243bb39c844b3543a7726576c869caf OK
2024/04/27 15:32:21 DEBUG : file1.txt.husapoz0.partial: renamed to: file1.txt
2024/04/27 15:32:21 INFO  : file1.txt: Copied (new)
2024/04/27 15:32:21 ERROR : Attempt 1/1 failed with 1 errors and: failed to set metadata: failed to change permissions: chmod /Volumes/RAMdisk/demo/dst/link1.txt: no such file or directory
2024/04/27 15:32:21 INFO  :
Transferred:   	         16 B / 16 B, 100%, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Transferred:            1 / 1, 100%
Elapsed time:         0.0s

2024/04/27 15:32:21 DEBUG : 7 go routines active
2024/04/27 15:32:21 Failed to copy: failed to set metadata: failed to change permissions: chmod /Volumes/RAMdisk/demo/dst/link1.txt: no such file or directory


What I think is happening

I think the issue is that rclone is copying the link and then trying to set metadata on a broken link. Note that with retries enabled, it works just fine since it will see the destination file already there and the metadata check will work

What I think should happen

Rclone should skip setting metadata on local links.