Search code examples
rsyncfreebsdcyrus

rysnc transfered file name differs from source file name


This problem is not specific to rsync. If I touch a file named /media/KINGSTON/seventeen. then what is created is /media/KINGSTON/seventeen instead. Can someone explain why?

dmesg
. . .
ugen3.2: <Kingston DataTraveler 3.0> at usbus3
umass0 on uhub6
umass0: <Kingston DataTraveler 3.0, class 0/0, rev 2.10/1.10, addr 2> on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:5:0: Attached to scbus5
da0 at umass-sim0 bus 0 scbus5 target 0 lun 0
da0: <Kingston DataTraveler 3.0 PMAP> Removable Direct Access SPC-4 SCSI device
da0: Serial Number 485B39472CCAB171D76F0DF0
da0: 40.000MB/s transfers
da0: 118272MB (242221056 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>


gpart show /dev/da0*
=>       63  242220993  da0  MBR  (116G)
         63      31041       - free -  (15M)
      31104  242189952    1  !12  [active]  (115G)

I am backing up a cyrus-imap mailstore using rsync. Cyrus imap message file names are numbers followed by a dot (####.). When these message files are transferred using rsync on a FreeBSD-11.2 host the trailing dot is removed on the target file name (####. becomes ####). Is there some way to prevent this behaviour?

rsync \
  --copy-links  \
  --no-group  \
  --no-perms   \
  --progress  \
  --protect-args  \
  --modify-window=1  \
  --recursive  \
  --times  \
  --update  \
  --verbose  \
     ./Documents/Personal/IMAP  \
     /media/KINGSTON/Documents/Personal/IMAP

It appears from further testing that this behaviour is dependent upon the destination. When copied from and to the system hdd the trailing dot appears in the target file name. When the target is a USB key then the dot disappears from the target.


Solution

  • A trailing dot or space is not permitted in a valid MS Windows file name. The transferred files have their names silently altered to meet this requirement when copied to a FAT formatted USB.

    From Microsoft file naming conventions (https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file):

    Do not end a file or directory name with a space or a period. Although the underlying file system may support such names, the Windows shell and user interface does not. However, it is acceptable to specify a period as the first character of a name. For example, ".temp".