Skip to content

Filenames containing dots lead to a "The system cannot find the file specified" sync error #7008

Closed

Description

@cryobry

v1.9.0 Linux syncing to v1.9.0 Windows

Any files containing dots in the path or filename causes a "the system cannot find the file specified" sync error on the Windows client.

See attached:
Screenshot from 2020-09-26 16-13-11

Activity

  1. added
    bug
    needs-triage
    on Sep 26, 2020
  2. calmh commented on Sep 27, 2020

    @calmh
    Member

    File or directory names on Windows cannot end with a trailing dot. Probably we should reject them with an "invalid filename" error at an earlier stage.

  3. tomasz1986 commented on Sep 27, 2020

    @tomasz1986
    Member

    File or directory names on Windows cannot end with a trailing dot. Probably we should reject them with an "invalid filename" error at an earlier stage.

    Hmm, I can sync such files/folders between my Windows and Android machines. They can be created using

    md \\?\C:\testfolder.
    echo>\\?\C:\testfile.
    

    or even

    echo>\\?\C:\NUL
    

    Although more of a hack than anything else, all of them are happily synced.

  4. calmh commented on Sep 28, 2020

    @calmh
    Member

    Probably some of the APIs we use don't like them. They're not supposed to exist, after all. :)

  5. added 2 commits that reference this issue on Sep 28, 2020
    903a1a0
    97c081b
  6. tomasz1986 commented on Sep 28, 2020

    @tomasz1986
    Member

    Yeah, but I am not sure if this is really the reason for the error described here though. I can synchronise them in my systems, and Syncthing does not complain at all.

    However, Android does not accept something like test./test.. Windows does. I think that this may be more of a file system related problem. Windows uses NTFS, while Android uses FAT.

  7. calmh commented on Sep 28, 2020

    @calmh
    Member

    I'm certain it's the reason, but whether it's because our mkdir does not work precisely the same way your shell md \\?\etc does or because the filesystem or OS or registry or something is different is unclear. It doesn't matter though because the root problem is that we're attempting to do something we shouldn't (create a directory with an unsupported name).

  8. tomasz1986 commented on Sep 28, 2020

    @tomasz1986
    Member

    Yes, but judging by what is going on in Android, I have a feeling that this is caused by the (ex)FAT system, and will be a problem regardless of the OS.

    Just for the record, this is what Syncthing on Android says:

    2020-09-28 06:44:00 Puller (folder "xxx" (xxxxx-xxxx), item "temp./temp."): syncing: resurrecting parent dir: file does not exist
    
  9. calmh commented on Sep 28, 2020

    @calmh
    Member

    It's indeed also true that FAT does not support all the things you might wish of a filesystem even when running under non-Windows. That's a different sort of problem though.

  10. tomasz1986 commented on Sep 28, 2020

    @tomasz1986
    Member

    All right. The problem, I guess, will mostly be limited to Android, where FAT is common.

    However, I have just seen that in the commit you included all the different reserved names like NUL, etc. but what about names followed by extensions? I mean NUL.txt, NUL.exe and similar. These are also considered "illegal" in Windows, i.e. Windows Explorer is unable to operate on them.

    From the MS link:

    Do not use the following reserved names for the name of a file:

    CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.

    It is not mentioned there, but even with multiple extensions, the file/folder will still be illegal, e.g. NUL.txt.txt and so on. Basically, anything starting with those illegal names and immediately followed by a dot seems to also be illegal.

  11. calmh commented on Sep 28, 2020

    @calmh
    Member

    I didn't test the illegality, just went by the "is not recommended" which I felt was less strong than "do not use" for the rest of the description. Those should apparently also be removed, yes.

  12. tomasz1986 commented on Sep 28, 2020

    @tomasz1986
    Member

    I am very sorry for writing again, but I just wanted to say that there is a loophole in the current handling of the invalid filenames.

    Basically, if an invalid file, e.g. CON, already exists in the folder on both sides, Syncthing will happily mark both "Up to Date". This can happen when sharing the folder for the first time with pre-existing files on both sides, or after copying the file manually to the other side. Syncthing also accepts all invalid filenames when the folder is "Unshared".

    Is this OK as it is, or should Syncthing also mark these as invalid?

  13. calmh commented on Sep 28, 2020

    @calmh
    Member

    I think that's fine. We try to prevent oddities. If you've managed to have pre-existing oddities you can keep them. :)

  14. added this to the v1.10.1 milestone on Sep 28, 2020
  15. jadsongmatos commented on Oct 19, 2020

    @jadsongmatos

    would be able to mark a specific file to not be synchronized ?
    example pet.notsync.jpg

  16. AudriusButkevicius commented on Oct 19, 2020

    @AudriusButkevicius
    Member

    Please use the forum for questions

  17. added
    frozen-due-to-age
    on Sep 29, 2021
  18. locked and limited conversation to collaborators on Sep 29, 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

    Labels

    bugfrozen-due-to-ageneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions