Skip to content

Relative path in destination vs Linux #4948

Open

Description

@fabh2o

What is the problem you are having with rclone?

Using a relative path (. or ..) in the destination path cause the file (or folder) to be uploaded but with the . and .. not "resolved". That means that on a Linux filesystem those directory become invisible: rclone mount, rclone serve doesn't show the folder, while rclone lsjson (and other ls type) does.

For example:
rclone copy file GoogleDrive:testDir/./dir1
rclone lsjson GoogleDrive:testDir -R | grep file : {"Path":"./dir1/file","Name":"file","Size":32...

I think that rclone should handle this paths like linux or at least give a warning.

Might be related to 4897

What is your rclone version (output from rclone version)

rclone v1.53.4
- os/arch: linux/amd64
- go version: go1.15.6

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

Manjaro 64bit

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

Google Drive

Edit: might be fixed in the beta version, i will try and report back

Activity

  1. ncw commented on Jan 22, 2021

    @ncw
    Member

    Rclone works like this because on object storage systems, paths with . and .. in filenames are common.

    I agree it is a bit odd.

    Maybe rclone should optionally normalize the paths on the command line and give a NOTICE if they aren't normalized.

  2. fabh2o commented on Jan 25, 2021

    @fabh2o
    Author

    Maybe rclone should optionally normalize the paths on the command line and give a NOTICE if they aren't normalized.

    If it's a valid thing, should this be labelled as new feature or enhancement?

  3. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    @fabh2o try this
    rclone copy file GoogleDrive:testDir/./dir1 --drive-encoding=None

  4. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    This request is similar to #4897 but this one is for cloud storage while #4897 is for local filesystem.

  5. fabh2o commented on Mar 16, 2021

    @fabh2o
    Author

    @fabh2o try this
    rclone copy file GoogleDrive:testDir/./dir1 --drive-encoding=None

    Setting the encoding flag has no effect: the folder structure created is the following testDir/./dir1/file

    • With the remote mounted, using ls and hexdump i found out that the "dot" is a "FULLWIDTH FULL STOP" (the bytes are ef bc 8e) and not the "illegal" .
    • On a web browser, the created folder name seems to be a normal dot
    • Using rclone lsjson GoogleDrive:testDir -R -P=false| grep file | jq '.Path' | hexdump, the "dot" is the same as the one reported by using rclone mount and ls

    PS, might be not relevant. I'm trying all the encoding options, seems like the Dot, LeftPeriod and the RightPeriod type create the following name ‛. (e2 80 9b ef bc 8e)

  6. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    No, it's not a "normal" ASCII dot but a UTF-8 pseudographics glyph that looks like a dot but is treated like a filename character by cloud. rclone performs this and other translations provider-wise.

    Normally it should be adjustable via command line by --BACKEND-encoding=comma,delimited,tokens (https://rclone.org/overview/#encoding and https://rclone.org/drive/#drive-encoding). I don't understand why it didn't work in your case. Gotta dig around this code https://github.com/rclone/rclone/blob/v1.53.4/backend/drive/drive.go#L491

  7. fabh2o commented on Mar 16, 2021

    @fabh2o
    Author

    I have tried other options for the --drive-encoding= flag, the results are in the PS of my previous comment

  8. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    Looks like a bug!

  9. self-assigned this
    on Mar 16, 2021
  10. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    This same trick worked for dropbox - #4875 (comment)

    I will investigate why it sucks for drive.

  11. ivandeex commented on Mar 16, 2021

    @ivandeex
    Member

    @ncw

    Let's introduce an option --normalize-path to normalize . and .. in paths before encoding
    with choices always,local,off,warn,?
    with local as default to turn it on by default for local storage only
    ?

    Moreover, it can be put in a future profile #2697

    EDIT
    If you agree in general to have path normalization in addition to (before / on top) path encoding, let's open another github issue or a forum thread to discuss details. I'm asking here only to stay close to a typical use, for convenience.

    Consider #4897 (comment) and #4875 (comment)

    Agreed with your #4948 (comment)

  12. ncw commented on Mar 23, 2021

    @ncw
    Member

    Let's introduce an option --normalize-path to normalize . and .. in paths before encoding
    with choices always,local,off,warn,?
    with local as default to turn it on by default for local storage only
    ?

    Moreover, it can be put in a future profile #2697

    A flag is a good idea.

    I wonder whether it might be backend configurable also.

    I think all the backends except for the bucket based backends (s3, gcs, swift, b2, etc) would always want normalized paths. These backends have a strong concept of a filesystem with folders for which path normalization makes sense.

    So maybe the selection should be always,auto,off,warn where auto looks to see if f.Features().BucketBased is set and doesn't normalize paths for those.

    What do you think?

    EDIT
    If you agree in general to have path normalization in addition to (before / on top) path encoding, let's open another github issue or a forum thread to discuss details. I'm asking here only to stay close to a typical use, for convenience.

    OK

  13. added this to the v1.57 milestone on Apr 4, 2021
  14. modified the milestones: v1.57, Soon on May 16, 2021
  15. removed their assignment
    on Dec 14, 2021
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions