Menu ▾ ▴

#120 TDirectorySync: names ending in a dot, and file names ending in a blank, are not supported

closed
nobody
1 day ago
4 days ago
No

TDirectorySync works with normal Win32 paths, and Windows changes some names in them:

  • A subdirectory whose name ends in a dot (data.) is read as the one without the dot: Windows drops a single trailing dot from every segment of a path. CheckOneWay reports the files of data under data., and the files of data. are never seen; SyncOneWay does not copy them.
  • A file whose name ends in a dot or a blank (x., x) cannot be opened, because Windows strips both from the last segment: SyncOneWay ends with EOSError "The system cannot find the file specified" from CopyFileEx.

A subdirectory whose name ends in a blank works since the follow-up of [bugs:#102]. Such names can only be created with the \\?\ prefix or e.g. by a Samba server. Both cases were measured on Delphi 12 with temporary tests.

Possible fix: work with \\?\ names internally (\\?\UNC\ for shares) for the enumeration, CreateDirectory, the copy and the move, which also lifts the MAX_PATH limit; the events would keep the normal names. Until then the class doc comment says what is not supported.

Related

Bug Reports: #102
Bug Reports: #122
Bug Reports: #123

Discussion

  • Thomas Mueller

    Thomas Mueller - 4 days ago

    Corrections and additions after a code review (the class doc comment says this since revision [r2564]):

    • The trailing dot was measured for a single dot in a segment in the middle of a path; several dots, or a dot mixed with blanks, were not tried.
    • A file whose name ends in a dot or a blank does not always end the sync with EOSError: that was measured with no handler assigned and no file of the shorter name. Read from the code: with an OnQueryFileSync handler it is skipped without a word, and an existing file of the shorter name in the source or destination is taken for it.
    • A subdirectory data. without a sibling data loses its files without a word, and SyncOneWay creates an empty data in the destination.
    • Such names also come from WSL or Cygwin tools writing to NTFS.
    • A subdirectory whose name ends in a blank is synced, but the events name it without a trailing backslash, so a handler must append one before passing it to Windows.
     

    Related

    Commit: [r2564]

  • Thomas Mueller

    Fixed in revision [r2567].

     

    Related

    Commit: [r2567]


Log in to post a comment.