Skip to content

mount: exports invalid windows file names #2333

Open

Description

@lopoki

What is the problem you are having with rclone?

https://forum.rclone.org/t/annoying-folder-name-bug/5756/3

I run 'rclone mount' and 'rclone move' on linux. I found that the file operation that I did as early as November 2017 has annoying file and folder name bug. Folders and files that ends with a dot or and space will look like garbage name in other machine such as windows and Android machine. Look at the example in the link above.
Basically, only Google drive official app on Android can see the name properly. All other apps will see the name as garbage.
As i do 'rclone mount' on linux and share with my network via Samba protocol, all my machines such as nvidia shield, android phone, windows pc all see the name of the folders and files as garbage.

What is your rclone version (eg output from rclone -V)

Both stable and beta. Beta one is
root@jupiter:~/# rclone -V
rclone v1.41-061-g96977547β

  • os/arch: linux/amd64
  • go version: go1.10.1

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

Rclone mount on linux ubuntu 64 bits and on Nvidia shield Linux /android base 64 bit

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

Google drive

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

rclone move and mount. Both with rclone cache and without. This bug affects as old as the time rclone doesn't have cache feature

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

Activity

  1. changed the title [-]Annoying folder name bug[/-] [+]mount: exports invalid windows file names[/+] on Jun 1, 2018
  2. ncw commented on Jun 1, 2018

    @ncw
    Member

    The root cause of this is mount exporting invalid file names to windows.

    This should probably be fixed with a flag (which defaults to true on windows) which does the same name translation as the onedrive backend. For example if a file has a ? in it will be mapped to ? instead.

    This should be a flag so that this can be enabled for linux servers which might serve to windows backends.

  3. added this to the Soon milestone on Jun 1, 2018
  4. ivandeex commented on Feb 9, 2021

    @ivandeex
    Member

    @lopoki Does the problem reproduce with rclone 1.54?

  5. ivandeex commented on Mar 15, 2021

    @ivandeex
    Member

    Ticket is forgotten by the author but it looks like the problem still needs a fix

  6. Maxime-J commented on Apr 15, 2021

    @Maxime-J

    Can confirm this would need a fix.
    Had an issue with a trailing space in a folder name (on a WebDav backend)

    User lost a bunch of files, he wasn't prompted with any errors on file saves,
    rclone considered these files uploaded (whereas they weren't) and deleted them after vfs-cache-max-age.
    So no way to recover.

    After some tests, no problem with rclone copy

    2021/04/15 17:48:33 DEBUG : Using config file from "C:\\Users\\Maxime\\.config\\rclone\\rclone.conf"
    2021/04/15 17:48:33 DEBUG : rclone: Version "v1.55.0" starting with parameters ["rclone" "copy" "ok.txt" "SC:WebDav/Test " "-vv"]
    2021/04/15 17:48:33 DEBUG : Creating backend with remote "ok.txt"
    2021/04/15 17:48:33 DEBUG : fs cache: adding new entry for parent of "ok.txt", "//?/C:/Users/Maxime/Documents/tools/rclone"
    2021/04/15 17:48:33 DEBUG : Creating backend with remote "SC:WebDav/Test "
    2021/04/15 17:48:34 DEBUG : ok.txt: Need to transfer - File not found at Destination
    2021/04/15 17:48:34 INFO  : ok.txt: Copied (new)
    2021/04/15 17:48:34 INFO  :
    Transferred:             2 / 2 Bytes, 100%, 3 Bytes/s, ETA 0s
    Transferred:            1 / 1, 100%
    Elapsed time:         1.5s
    
    2021/04/15 17:48:34 DEBUG : 4 go routines active
    

    But mount says it's uploaded whereas it's not

    2021/04/15 17:50:10 DEBUG : Test /ok.txt: vfs cache: starting upload
    2021/04/15 17:50:10 INFO  : Test /ok.txt: vfs cache: upload succeeded try #1
    

    Moreover, if I drag and drop the file to that folder with trailing space,
    it still isn't uploaded but a new folder without the trailing space is created on the backend

    And here is a few more output on a remount

    2021/04/15 17:41:11 ERROR : Local file system at //?/C:/Users/Maxime/AppData/Local/rclone/vfs/SC/WebDav: Failed to list "Test ": directory not found
    2021/04/15 17:41:11 DEBUG : Test : Removing directory
    2021/04/15 17:41:11 ERROR : Test : Failed to rmdir: remove \\?\C:\Users\Maxime\AppData\Local\rclone\vfs\SC\WebDav\Test␠: Le fichier spécifié est introuvable.
    2021/04/15 17:41:11 ERROR : Local file system at //?/C:/Users/Maxime/AppData/Local/rclone/vfs/SC/WebDav: vfs cache: failed to remove empty directories from cache path "": remove \\?\C:\Users\Maxime\AppData\Local\rclone\vfs\SC\WebDav\Test␠: Le fichier spécifié est introuvable.
    2021/04/15 17:41:11 ERROR : Local file system at //?/C:/Users/Maxime/AppData/Local/rclone/vfs/SC/WebDav: Failed to list "Test ": directory not found
    2021/04/15 17:41:11 DEBUG : Test : Removing directory
    2021/04/15 17:41:11 ERROR : Test : Failed to rmdir: remove \\?\C:\Users\Maxime\AppData\Local\rclone\vfs\SC\WebDav\Test␠: Le fichier spécifié est introuvable.
    2021/04/15 17:41:11 ERROR : Local file system at //?/C:/Users/Maxime/AppData/Local/rclone/vfs/SC/WebDav: vfs cache: failed to remove empty directories from metadata cache path "": remove \\?\C:\Users\Maxime\AppData\Local\rclone\vfs\SC\WebDav\Test␠: Le fichier spécifié est introuvable.
    

    I can run some more tests if needed.

  7. stueja commented on Jul 27, 2023

    @stueja

    May I add that this happens also between a Linux environment and a Hetzner Storagebox using rclone 1.63.1.

    One Linux host (merak) uploads files and folders via rclone/sftp into the storagebox. Another host (dubhealpha) mounts a cifs share of the storagebox.

    rclone:

    jan@dubhealpha:~$ rclone lsd bx-sftp:MyVideos/Movies
    ...
              -1 2023-07-27 01:45:28        -1 Mission: Impossible - Phantom Protokoll (2011)
              -1 2023-07-27 06:52:41        -1 Mission: Impossible - Rogue Nation (2015)
              -1 2023-07-27 03:56:24        -1 Mission: Impossible II (2000)
              -1 2023-07-26 22:10:52        -1 Mission: Impossible III (2006)
    

    ls of the cifs mount:

    jan@dubhealpha:~$ ll /mnt/MyVideos/Movies/
    total 0
    ...
    drwxrwx--- 2 plex plex 0 Jul 27 03:56  MFKEWH~X/
    drwxrwx--- 2 plex plex 0 Jul 26 22:10  MPDRNJ~4/
    drwxrwx--- 2 plex plex 0 Jul 27 01:45  MQIH0R~7/
    drwxrwx--- 2 plex plex 0 Jul 27 06:52  MS0HZR~P/
    
    

    rclone lsd after renaming the garbled name to its original shows strange characters: (in kitty on Arch Linux with the JetBrainsMono font it looks like a bullet list in an application window)

              -1 2023-07-27 18:33:03        -1 Mission Impossible - Fallout (2018)
              -1 2023-07-27 18:34:43        -1 Mission Impossible - Phantom Protokoll (2011)
              -1 2023-07-27 18:37:16        -1 Mission Impossible - Rogue Nation (2015)
              -1 2023-07-27 18:35:27        -1 Mission Impossible II (2000)
              -1 2023-07-27 18:36:07        -1 Mission Impossible III (2006)
    

    So how can I work around that?

    The cifs mount:

    jan@dubhealpha:~$ grep MyVideos /etc/fstab
    //u356922.your-storagebox.de/backup/MyVideos /mnt/MyVideos       cifs    iocharset=utf8,rw,credentials=/root/storagebox-credentials.txt,uid=998,gid=998,file_mode=0660,dir_mode=0770 0       0
    

    Le Config(tm):

    jan@merak:~$ cat .config/rclone/rclone.conf 
    [bx-sftp]
    type = sftp
    host = <xyz>.your-storagebox.de
    user = <xyz>
    port = 23
    key_file = ~/.ssh/storagebox
    md5sum_command = md5 -r
    sha1sum_command = sha1 -r
    shell_type = unix
    

    Le Command(tm):

    jan@merak:~$ ps ax | grep "rclone sync"
      43917 pts/2    Sl+  269:22 rclone sync -P --transfers=1 --sftp-concurrency=1 --sftp-chunk-size=252k --checkers=4 --order-by=size,desc --bwlimit=4M . bx-sftp:MyVideos/Movies
    

    Edit: just saw that the original issue is kinda seasoned. Let me know and I open a new one.

  8. ncw commented on Jul 28, 2023

    @ncw
    Member

    This is what I wrote above @Maxime-J

    And I think this is the cause of your problems too.

    For example you can't have a : in a windows file name so WinFSP is mapping it to a private unicode range which doesn't display well on most OSes

    winfsp/sshfs-win#22

    The root cause of this is mount exporting invalid file names to windows.

    This should probably be fixed with a flag (which defaults to true on windows) which does the same name translation as the onedrive backend. For example if a file has a ? in it will be mapped to ? instead.

    This should be a flag so that this can be enabled for linux servers which might serve to windows backends.

    I think if rclone did the name translation in the VFS layer then this would fix the problem, so the vfs needs a --vfs-encoding flag which defaults to the same encoding as --local-encoding but can be changed for linux servers serving to Windows.

    Do you think that describes your problem?

  9. stueja commented on Jul 28, 2023

    @stueja

    Ah then maybe I misunderstood something.

    I was under the impression that the colon problem affected Windows and not Linux.
    Since I am using rclone in a Linux-only environment, my assumption was that the colon will be transferred as a colon. (However, I can only assume that the Hetzner storage box is Unix/Linux; rclone finds md5 and sha and reports shell_type = unix). So from my earlier understanding, no WinFSP involved and no name translation necessary in theory.
    This is why I wanted to add this behaviour under Linux here in this issue. It was the first most matching issue which came up to my search for the problem.

    From my understanding now, rclone uses WinFSP, whether or not Windows is involved. Is that correct?

    Again, if this is sitting in the wrong issue here, then I will be glad to open a new one.

  10. ncw commented on Jul 28, 2023

    @ncw
    Member

    @stueja sorry I didn't read your post carefully enough. Yes you can store files with : on storagebox. However I'm not sure CIFS/smb can show them.

    For example see: https://unix.stackexchange.com/questions/299130/samba-how-to-display-files-with-colon-in-their-names

    So I think that it is Windows file names that are the problem but in the samba layer.

  11. stueja commented on Jul 28, 2023

    @stueja

    Ah! CIFS/Samba! Great Odin's raven! I will test that. Thank you very much!

    Edit: scratch that. The proposed solution mangled names = no is of course a samba server setting, and the samba server is under Hetzner's control. Thank you anyway, I will implement some measure on my side that removes colons.

  12. ncw commented on Jul 29, 2023

    @ncw
    Member

    Ah! CIFS/Samba! Great Odin's raven! I will test that. Thank you very much!

    Edit: scratch that. The proposed solution mangled names = no is of course a samba server setting, and the samba server is under Hetzner's control. Thank you anyway, I will implement some measure on my side that removes colons.

    If the sftp backend had an --encoding-sftp flag you could use this to fix the problem. But apparently it doesn't! I guess because most sftp servers are unix based.

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