Thanks for reworking these changes, Vasant. Please trim the 1/2 and 2/2 patch subjects down to around 50 chars (including a "exfat: " prefix), with the details moved into the commit message body... On Thu, 10 Mar 2022 15:24:55 +0100, Vasant Karasulli wrote: > #exFAT > The concatenated file name has the same set of illegal characters as > other FAT-based file systems (see Table 31). > > #FAT > ... > Leading and trailing spaces in a long name are ignored. > Leading and embedded periods are allowed in a name and are stored in > the long name. Trailing periods are ignored. > > Note: Leading and trailing space ' ' characters are currently retained > by Linux kernel exfat, in conflict with the above specification. I think it makes sense to mention your findings from the Windows tests here. E.g. "Windows 10 also retains leading and trailing space characters". > Some implementations, such as fuse-exfat, don't perform path trailer > removal. When mounting images which contain trailing-dot paths, these > paths are unreachable, e.g.: > > + mount.exfat-fuse /dev/zram0 /mnt/test/ > FUSE exfat 1.3.0 > + cd /mnt/test/ > + touch fuse_created_dots... ' fuse_created_spaces ' > + ls -l > total 0 > -rwxrwxrwx 1 root 0 0 Aug 18 09:45 ' fuse_created_spaces ' > -rwxrwxrwx 1 root 0 0 Aug 18 09:45 fuse_created_dots... > + cd / > + umount /mnt/test/ > + mount -t exfat /dev/zram0 /mnt/test > + cd /mnt/test > + ls -l > ls: cannot access 'fuse_created_dots...': No such file or directory > total 0 > -rwxr-xr-x 1 root 0 0 Aug 18 09:45 ' fuse_created_spaces ' > -????????? ? ? ? ? ? fuse_created_dots... > + touch kexfat_created_dots... ' kexfat_created_spaces ' > + ls -l > ls: cannot access 'fuse_created_dots...': No such file or directory > total 0 > -rwxr-xr-x 1 root 0 0 Aug 18 09:45 ' fuse_created_spaces ' > -rwxr-xr-x 1 root 0 0 Aug 18 09:45 ' kexfat_created_spaces ' > -????????? ? ? ? ? ? fuse_created_dots... > -rwxr-xr-x 1 root 0 0 Aug 18 09:45 kexfat_created_dots > + cd / > + umount /mnt/test/ > > With this change, the "keep_last_dots" mount option can be used to access > paths with trailing periods and disallow creating files with names with > trailing periods. E.g. continuing from the previous example: > > + mount -t exfat -o keep_last_dots /dev/zram0 /mnt/test > + cd /mnt/test > + ls -l > total 0 > -rwxr-xr-x 1 root 0 0 Aug 18 10:32 ' fuse_created_spaces ' > -rwxr-xr-x 1 root 0 0 Aug 18 10:32 ' kexfat_created_spaces ' > -rwxr-xr-x 1 root 0 0 Aug 18 10:32 fuse_created_dots... > -rwxr-xr-x 1 root 0 0 Aug 18 10:32 kexfat_created_dots It'd be nice to demonstrate "keep_last_dots" creation here as well, e.g. + echo > kexfat_created_dots_again... sh: kexfat_created_dots_again...: Invalid argument @Namjae: not sure whether this is what you had in mind for preventing creation of invalid paths. What's your preference? Cheers, David