Skip to content

unsound canonicalization of root paths breaks copy on local remote #9510

Description

@benaryorg

The associated forum post URL from https://forum.rclone.org

https://forum.rclone.org/t/copy-the-cwd-including-symlinks-how/53902

What is the problem you are having with rclone?

cleanRootPath uses filepath.Abs to turn the provided path of a local remote into an absolute path.
The absolute path is not guaranteed to be the same path that a relative path refers to.
Some paths on Linux do not have an absolute path.
Examples:

  • directories referred to as just file descriptors
  • deleted files which are still open
  • directories which have been shadowed by a mount but are still open via either a file descriptor or cwd

All of these may have a relative path which when opened refers to a distinct directory from the relative one.

So taking that as it is, this line of debug output further down illustrates why the sync doesn't work:

2026/06/10 11:52:55 DEBUG : fs cache: renaming cache item "." to be canonical "/tmp/tmp.JiUJa08sYz/src"

Removing the entire call to cleanRootPath fixes the problem, but is obviously overcorrecting.
There's probably a solution which keeps the encoding mechanism and maybe some others in cleanRootPath while also basically removing the canonicalization.

What is your rclone version (output from rclone version)

rclone v1.74.2

  • os/version: nixos 26.11 (64 bit)
  • os/kernel: 7.0.11 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.26.3
  • go/linking: dynamic
  • go/tags: cmount

Which OS you are using and how many bits (e.g. Windows 7, 64 bit)

% uname -mrs
Linux 7.0.11 x86_64

Which cloud storage system are you using? (e.g. Google Drive)

local

The command you were trying to run (e.g. rclone copy /tmp remote:tmp)

This is a working PoC:

# run this in an empty directory like via: cd $(mktemp -dp /tmp)

mkdir src
echo foo > src/bar
ln -s baz src/quux

cd src
sudo mount none -t tmpfs ..

# this will fail
rclone copy --metadata --links . ../dst-rclone
# this will work
cp -ra . ../dst-cp

Note: copy, copyto, sync behave basically the same.

A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)

2026/06/10 11:52:54 DEBUG : rclone: Version "v1.74.2" starting with parameters ["[…]/rclone" "copy" "--metadata" "--links" "-vv" "." "../dst-rclone"]
2026/06/10 11:52:55 DEBUG : Creating backend with remote "."
2026/06/10 11:52:55 NOTICE: Config file "[…]/.config/rclone/rclone.conf" not found - using defaults
2026/06/10 11:52:55 DEBUG : fs cache: renaming cache item "." to be canonical "/tmp/tmp.JiUJa08sYz/src"
2026/06/10 11:52:55 DEBUG : Creating backend with remote "../dst-rclone"
2026/06/10 11:52:55 DEBUG : fs cache: renaming cache item "../dst-rclone" to be canonical "/tmp/tmp.JiUJa08sYz/dst-rclone"
2026/06/10 11:52:55 ERROR : Local file system at /tmp/tmp.JiUJa08sYz/src: error reading source root directory: directory not found
2026/06/10 11:52:55 DEBUG : Local file system at /tmp/tmp.JiUJa08sYz/dst-rclone: Waiting for checks to finish
2026/06/10 11:52:55 DEBUG : Local file system at /tmp/tmp.JiUJa08sYz/dst-rclone: Waiting for transfers to finish
2026/06/10 11:52:55 ERROR : Attempt 1/3 failed with 1 errors and: directory not found
2026/06/10 11:52:55 ERROR : Local file system at /tmp/tmp.JiUJa08sYz/src: error reading source root directory: directory not found
2026/06/10 11:52:55 DEBUG : Local file system at /tmp/tmp.JiUJa08sYz/dst-rclone: Waiting for checks to finish
2026/06/10 11:52:55 DEBUG : Local file system at /tmp/tmp.JiUJa08sYz/dst-rclone: Waiting for transfers to finish
2026/06/10 11:52:55 ERROR : Attempt 2/3 failed with 1 errors and: directory not found
2026/06/10 11:52:55 ERROR : Local file system at /tmp/tmp.JiUJa08sYz/src: error reading source root directory: directory not found
2026/06/10 11:52:55 DEBUG : Local file system at /tmp/tmp.JiUJa08sYz/dst-rclone: Waiting for checks to finish
2026/06/10 11:52:55 DEBUG : Local file system at /tmp/tmp.JiUJa08sYz/dst-rclone: Waiting for transfers to finish
2026/06/10 11:52:55 ERROR : Attempt 3/3 failed with 1 errors and: directory not found
2026/06/10 11:52:55 INFO  :
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Errors:                 1 (retrying may help)
Elapsed time:         0.0s

2026/06/10 11:52:55 DEBUG : 5 go routines active
2026/06/10 11:52:55 NOTICE: Failed to copy: directory not found

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions