Fedora NTFS-3G happily writes files with invalid chars in filename?

Roberto Ragusa mail at robertoragusa.it
Sat Sep 1 20:13:33 UTC 2012


On 09/01/2012 09:20 PM, Joe Zeff wrote:
> On 09/01/2012 11:28 AM, Fernando Cassia wrote:
>> Now I connect the external usb NTFS-formatted drive to my old xpsp3
>> running netbook and stumble upon a file (a folder actually under
>> .cache\vlc\art\artistalbum\The Rapture\How Deep is Your Love?
>> that ABSOLUTELY canĀ“t be removed from WinXP, as windows thinks
>> question marks are an "invalid character" in a file or folder name.
> 
> Of course it's an invalid character for XP, just as it is for Linux. The question mark is a wildcard, used to represent one unknown character, just as an asterisk is used to represent any number of unknown characters.  Thus, test?.txt will match test1.txt or test2.txt but not test12.txt.  Have you tried putting quotation marks around the name to keep it from being expanded?

You say it is invalid, then you say you have to escape it.
It is perfectly valid in Linux. You just have to escape it to avoid
confusion inside the shell (no issue with GUI programs).

[root at thinkpad ~]# cd /tmp
[root at thinkpad tmp]# mkdir tests
[root at thinkpad tmp]# cd tests
[root at thinkpad tests]# date >ok\?
[root at thinkpad tests]# ls -l
total 4
-rw-r--r-- 1 root root 30 Sep  1 22:02 ok?
[root at thinkpad tests]# cat ok\?
Sat Sep  1 22:02:45 CEST 2012
[root at thinkpad tests]# rm ok\?
rm: remove regular file `ok?'? y
[root at thinkpad tests]# ls -l
total 0

The only character forbidden character is the slash (obviously) and I'm not sure about
the 0x00 byte (which would make a mess with C strings).
You can also use invalid utf8; in fact the filesystem does not care about
charset encoding, file names are sequences of bytes.
[Linus personally rejected the proposal to associate an encoding to a filesystem
(and he did it with good reasons, I'd say)]

The problem on Windows can probably solved by using the command prompt and
something tricky, like recursively deleting the parent directory of the file.

Best regards.
-- 
   Roberto Ragusa    mail at robertoragusa.it


More information about the users mailing list