Can't access file with ‛ in the name

What is the problem you are having with rclone?

Can't access file with ‛ (the character used to escape restricted characters) in the name.

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

rclone v1.64.2
- os/version: debian 12.2 (64 bit)
- os/kernel: 6.1.0-13-amd64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.3
- go/linking: static
- go/tags: none

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

Local and OneDrive, et.al. There I take local as the example.

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

echo 'here is the content' > '‛'
rclone cat ‛
rclone cat ‛‛
rclone cat ‛‛‛
rclone cat ‛‛‛‛

Things are same for other verbs.

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[local]
encoding = Dot

It looks like the behavior is the same even with the default values.

A log from the command that you were trying to run with the -vv flag

rclone cat ‛ -vv
<7>DEBUG : rclone: Version "v1.64.2" starting with parameters ["rclone" "cat" "‛" "-vv"]
<7>DEBUG : rclone: systemd logging support activated
<7>DEBUG : Creating backend with remote "‛"
<7>DEBUG : Using config file from "/home/<myusername>/.config/rclone/rclone.conf"
<7>DEBUG : fs cache: renaming cache item "‛" to be canonical "/tmp/test/‛‛"
<3>ERROR : : error listing: directory not found
<7>DEBUG : 4 go routines active
Failed to cat with 2 errors: last error was: directory not found

For special character, you want to escape them as it's s shell thing unrelated to clone.

texter@macmini test % rclone cat \`test
2023/11/25 09:32:14 NOTICE: Config file "/Users/texter/.config/rclone/rclone.conf" not found - using defaults
blah

It is (U+201B), not the character ` . And it is not need to be escaped for shell.
This can be confirmed through the log

<7>DEBUG : rclone: Version "v1.64.2" starting with parameters ["rclone" "cat" "‛" "-vv"]

rclone recived the correct character.

A single quote?

Yes, you do:

texter@macmini test % rclone ls 'test2
quote>
texter@macmini test % rclone ls \'test2
2023/11/25 09:54:57 NOTICE: Config file "/Users/texter/.config/rclone/rclone.conf" not found - using defaults
        0 'test2

No, it is not the usual single quote (ASCII 0x27). it is U+201B.
You can copy this character from my command as it cannot be directly typed.
This character present in Overview of cloud storage systems

Ok, specifically, the Single High-Reversed-9 Quotation Mark.

texter@macmini test % ls ‘test
‘test
texter@macmini test % rclone ls ‘test
2023/11/25 10:22:27 NOTICE: Config file "/Users/texter/.config/rclone/rclone.conf" not found - using defaults
        0 ‘test

and I used this to make it:

Unfortunately, this is still not the same character :joy:

I checked it in python:

>>> ord('‘')  # yours
8216
>>> ord('‛')  # mine
8219

And as what is shown in the right of your character viewer, what you selected is LEFT SINGLE QUOTATION MARK, not SINGLE HIGH-REVERSED-9 QUOTATION MARK.

I can reproduce it on macOS:

When using (U+201B, 8219)

$ echo "test" > ‛
 
$ cat ‛
test
 
$ rclone cat ‛ -vv
2023/11/25 16:10:40 DEBUG : rclone: Version "v1.64.2" starting with parameters ["rclone" "cat" "‛" "-vv"]
2023/11/25 16:10:40 DEBUG : Creating backend with remote "‛"
2023/11/25 16:10:40 DEBUG : Using config file from "/Users/kptsky/.config/rclone/rclone.conf"
2023/11/25 16:10:40 DEBUG : fs cache: renaming cache item "‛" to be canonical "/Users/kptsky/Temp/test/‛‛"
2023/11/25 16:10:40 ERROR : : error listing: directory not found
2023/11/25 16:10:40 DEBUG : 5 go routines active
2023/11/25 16:10:40 Failed to cat with 2 errors: last error was: directory not found

All works with (U+2018, 8216)

$ echo "test" > ‘

$ cat ‘
test

$ rclone cat  ‘
test

Yeah, I finally got the right one on the 9146th try:

image

Looks like Rclone does something on that particular character to convert it even if I tell it not to.

texter@macmini test % ls
‛testagain
texter@macmini test % rclone ls `pwd`
2023/11/25 12:17:35 NOTICE: Config file "/Users/texter/.config/rclone/rclone.conf" not found - using defaults
        0 ‛‛testagain

texter@macmini test % rclone ls `pwd` --local-encoding None
2023/11/25 12:18:04 NOTICE: Config file "/Users/texter/.config/rclone/rclone.conf" not found - using defaults
        0 ‛‛testagain

After reading the code, I understand that the story is like this:

  • For human input, rclone treated it as already be encoded as a way called "Standard", which means EncodeZero | EncodeSlash | EncodeCtl | EncodeDel | EncodeDot
  • Then rclone will decode it and encode back with the encoding of this backend (FromStandardPath). And use the encoded path to access the backend.
  • encoding = None, which corresponds to EncodeZero, does NOT mean no encoding. Actually, it means the encoding NUL(0x00) → , Therefore, we have no way to indicates rclone not to use encoding if we follow the design faithfully.

However, there is a short-circuit simplified code in FromStandardPath:

  • If the target encoding is equal to "Standard", FromStandardPath will do nothing but just return the input path.

Therefore, One trick to solve my problem is use "Standard" as the encoding for backend:

$ rclone cat ‛ --local-encoding None,Slash,Ctl,Del,Dot
here is the content

I think this issue reflects that the current design needs improvement, as currently:

  • None actually do NUL(0x00) → and ‛‛
  • None,Slash,Ctl,Del,Dot behave like the encoding is disabled

which is counter-intuitive.

1 Like

I opened the issue in The design of encoding for restricted characters is counter-intuitive · Issue #7456 · rclone/rclone · GitHub

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.