Skip to content

It's possible to create a file illegally named "." in dropbox #4875

Closed

Description

@sgbeal

What is the problem you are having with rclone?

An invocation which includes a trailing /. on the target path (as is often done by long-time Unix users) causes an entry to be created in dropbox named ".".
For example:

rclone copy somefile dropbox:somedir/.

A user might reasonably expect somedir/. to be interpreted the same as somedir, like it is for all other Unix-like tools. e.g. with cp or scp, adding /. to the end of the target dir will cause the copy to fail if the target dir doesn't exist, rather than copying the target file to a file named somedir.

Instead the target gets a directory named "." and somefile copied into it.

"." is not a legal name for a directory on any known non-cloud storage, as it's reserved for "current directory."

My proposal is that rclone silently lop off any trailing "/." from the name, as the intent of adding "/.", as its interpreted by every other tool, is exactly what rclone already does without the "/.". Because "." is (outside of cloud storage) not a legal directory name, it seems highly unlikely that anyone actually relies on the current behaviour.

What is your rclone version (output from rclone version)

rclone v1.53.1
- os/arch: linux/arm
- go version: go1.15

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

Raspberry Pi OS 10

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

DropBox and Google Drive both exhibit this.

The DropBox web UI will not allow one to create a directory with this name, but GDrive's web UI does.

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

rclone copy somefile dropbox:somedir/.

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

$ rclone -vv copy conversion.txt gdrive:xfer/.
2020/12/16 11:39:17 DEBUG : rclone: Version "v1.53.1" starting with parameters ["rclone" "-vv" "copy" "conversion.txt" "gdrive:xfer/."]
2020/12/16 11:39:17 DEBUG : Creating backend with remote "conversion.txt"
2020/12/16 11:39:17 DEBUG : Using config file from "/home/pi/.config/rclone/rclone.conf"
2020/12/16 11:39:17 DEBUG : fs cache: adding new entry for parent of "conversion.txt", "/<SNIP>"
2020/12/16 11:39:17 DEBUG : Creating backend with remote "gdrive:xfer/."
2020/12/16 11:39:17 DEBUG : Google drive root 'xfer/.': root_folder_id = "<SNIP>" - save this in the config to speed up startup
2020/12/16 11:39:19 DEBUG : conversion.txt: Need to transfer - File not found at Destination
2020/12/16 11:39:21 DEBUG : conversion.txt: MD5 = 6e8f7d56b5c772c227ea5e0b5d997a05 OK
2020/12/16 11:39:21 INFO  : conversion.txt: Copied (new)
2020/12/16 11:39:21 INFO  : 
Transferred:   	    1.137k / 1.137 kBytes, 100%, 428 Bytes/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         4.4s

2020/12/16 11:39:21 DEBUG : 4 go routines active

Activity

  1. ncw commented on Dec 18, 2020

    @ncw
    Member

    I think the fix I've been working on in #4862 will fix this issue too - can you give it a try?

    v1.54.0-beta.4970.7493dd856.fix-4862-fs-parse on branch fix-4862-fs-parse (uploaded in 15-30 mins)

  2. sgbeal commented on Dec 18, 2020

    @sgbeal
    Author

    i am very much a git zero[1], so i'll need more information on that for how to check out that branch :/. Simply doing checkout branchname on a clone of this repo isn't doing it for me:

    $ git checkout fix-4862-fs-parse 
    error: pathspec 'fix-4862-fs-parse' did not match any file(s) known to git
    

    Following the fix-4862-... link in your response leads to github's 404 page.

    v1.54.0-beta.4970.7493dd856.fix-4862-fs-parse

    Over there i'm only seeing what appear to be zip files of builds for bsd/plan9/solaris platforms i don't have, and not any sources.

    [1] = i'm a long-time developer on the Fossil SCM project and, quite thankfully, almost never have to work with git, so operations more involved than clone or checkout of an existing branch are usually beyond my git-fu.

  3. animosity022 commented on Dec 20, 2020

    @animosity022
    Contributor

    The build failed so he'll have to redo it.

    It takes times to build so he posts the link and at times, it doesn't build so he's gotta redo it.

    Nothing to do from your side until the build gets fixed.

  4. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    @sgbeal
    That git branch has been merged in and released. Try to install the latest version 1.54.1 - https://rclone.org/install/
    Does it help?

  5. sgbeal commented on Mar 16, 2021

    @sgbeal
    Author

    1.54.1 still exhibits this behaviour. The "." directory in the attached screenshot now contains the file "foo.c".

    It's not tragic, it's just counter to years of CLI muscle memory which believes that tagging /. on the end of a directory target is "best practice" to avoid creating a file with the target directory's name by accident if the target name is mis-typed (in particular over SSH connections where tab completion isn't available).

    image

  6. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    I think this should help
    rclone copy somefile dropbox:somedir/. --dropbox-encoding None

  7. sgbeal commented on Mar 16, 2021

    @sgbeal
    Author
    $ rclone copy foo.c dropbox:xfer/. --dropbox-encoding None
    2021/03/16 22:50:49 ERROR : Can't retry any of the errors - not attempting retries
    2021/03/16 22:50:49 Failed to copy: path/malformed_path/
    

    That's arguably an improvement over creation of a dir named ".". How can (or can at all?) that encoding option be set as the default in my rclone config?

  8. sgbeal commented on Mar 16, 2021

    @sgbeal
    Author

    That's arguably an improvement over creation of a dir named ".". How can (or can at all?) that encoding option be set as the default in my rclone config?

    Nevermind:

    encoding = None
    

    does the trick. :)

  9. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    Right, this will do the trick, but I'd recommend

    [your-remote]
    type = dropbox
    ......
    encoding = InvalidUtf8
    

    Actually, it's not a "normal" ASCII dot but a UTF-8 wide dot glyph that looks like a dot but is treated as a directory name by cloud.
    rclone performs this and other translations provider-wise as many local filesystem conventions are different in the cloud world.

  10. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    Probably we will introduce an option to normalize paths before encoding.

    references: #4897 (comment) and #4948 (comment)

  11. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    I hope this is resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions