FS#5659 - renaming can generate filenames that are inaccessible from windows

Attached to Project: Rockbox
Opened by tSav (FranzFerdinand) - Thursday, 13 July 2006, 23:45 GMT
Last edited by Jonathan Gordon (jdgordon) - Tuesday, 03 July 2007, 09:53 GMT
Task Type Bugs
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


I managed to rename the "pictures" folder in my X5 in "-<Pictures". The "<" makes the folder name invalid, hence the folder is inaccessible.

Is being able to change file/dir name to an invalid name a bug?
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Tuesday, 03 July 2007, 09:53 GMT
Reason for closing:  Fixed
Comment by Dominik Riebeling (bluebrother) - Friday, 14 July 2006, 06:59 GMT
I tried it on my h120. I was able renaming by adding a "<" to a file which is then inaccessible in windows. The file shows up, but file operations fail. BUT when connecting to a linux box I can access and modify that file. So the filename is not invalid per se to the FAT filesystem, but only windows' capabilities are limited (in fact, I noted more than once that windows is pretty limited regarding "legal" characters in filenames, as the filesystem itself supports more).
Also, I tried renaming a file by adding a "/", which is definitely invalid on FAT filesystems. That rename failed, so I wouldn't say you can generate invalid filenames using rockbox, only filenames that aren't accessible from windows.
Comment by Bryn Smith (thePianoMan) - Monday, 07 August 2006, 02:54 GMT
Microsoft wrote the FAT32 specification, and according to their (publicly available) specification, the only special characters allowed in the first 127 characters of the ASCII table are the following:

$ % ' - _ @ ~ ` ! ( ) { } ^ # &
+ , ; = [ ]
. <space>

Maybe the validation code should be a little more strict...?
Comment by Jonas Häggqvist (rasher) - Friday, 22 September 2006, 09:23 GMT
IIRC, the validation code is practically nonexistant. Yeah, I just checked. The only thing that is checked, as far as I can see, is that the filename doesn't end in a "." (which got filed as a bugreport). The place to improve error-checking is firmware/fat.c line 1177 (fat_checkname()).

I believe Rockbox shouldn't break the FAT specs (which I admittedly haven't read), even if Linux is more forgiving.
Comment by Jonas Häggqvist (rasher) - Saturday, 25 November 2006, 12:04 GMT
I've written a patch  FS#6358  which checks for the following illegal characters: " * / : < > ? \\ |