ntfs3: windows_names option fails to reject invalid characters like '?'
A message that is not in the archive (sent off-list or not yet received): [email protected]
Konstantin Komarov
maintainerQuoted 18 lines · Szekeres Tamás
Hi Konstantin and the ntfs3 team,
I have encountered a bug regarding the '
windows_names' mount option in the ntfs3 driver, which leads to data loss when the drive is later connected to a Windows machine.[Problem Description]
When specifying a backup folder and creating a new directory on an NTFS-formatted USB drive, the driver accepts the "?" character in the directory name without any errors (for example, creating a folder named "something?wrong").
The directory is created successfully under Linux, and the backup process runs and finishes without warning. However, when the USB drive is later plugged into a Windows machine, Windows is completely unable to access this directory. Running 'chkdsk' on Windows resolves the filesystem issue but does so by completely deleting the entire backup directory, resulting in severe data loss.[Question / Expected Behavior]
Why doesn't the ntfs3 driver actively check for and reject Windows-disallowed special characters (like '\ / : * ? " < > |') before creating the folder, especially when 'windows_names' is used? It should return an error (like Invalid Argument) during the directory creation stage to prevent this.[System Information]
- Kernel version: 7.0.0-14-generic
- Distribution: Ubuntu 26.04
- Mount options used: defaults,windows_names (just clicked te drive in
Nautilusor)
I can provide further dmesg logs or system outputs if necessary. Thank you for your hard work on this driver, looking forward to your feedback.
Quoted 2 lines
Best regards,
Tamás Szekeres
Hello,
Sorry for the delay.
I can't reproduce the problem: creating a directory with '?' in the name fails with -EINVAL here, with windows_names on, which is the intended behaviour.
I suspect the option wasn't actually applied. Mounting from Nautilus goes through udisks2, which builds its own option list and ignores what you'd normally pass - so the mount may well have had windows_names off. Could you mount the drive the same way and run:
findmnt -no OPTIONS <mountpoint>
If windows_names isn't in that list, that explains it, and the place to fix it is udisks2 rather than the driver.
Regards,
Konstantin