• Status Closed
  • Percent Complete
  • Task Type Bugs
  • Category Drivers
  • Assigned To
  • Operating System
  • Severity Medium
  • Priority Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by combthins - 2003-08-03
Last edited by rasher - 2005-09-07

FS#1573 - Should prevent saving "filename."

If you save a filename ending in "." the file is impossible
to remove, rename or open using Windows. For example
on General Settings menu, save settings to "config00."

The only way I have found to remove the file is using
the ROCKbox ON-PLAY menu. Windows lists the file but
can't do anything with it. cygwin "ls" sometimes lists it,
depending what options you give it, but can't remove or
rename it.

I assume that "filename." is an illegal filename as far as
FAT is concerned, so we should prevent ROCKbox from
creating such files.

Also, if we allow the user to create files called "." or ".."
that might cause even bigger problems. I haven't tried it.

Found on Player built from tarball rockbox-daily-

Closed by  rasher
2005-09-07 02:08
Reason for closing:  Fixed
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Logged In: YES

I just committed my patch that prevents filenames ending in
periods. Additional checks for filename validity can
relatively easy be added.

Closing this bug. Reopen if the commit is reverted.

Can't Scandisk repair those files? I cannot believe that is
really impossible to delete broken files in Windows. This has to
be a feature of an operating system.

have you tried to rename these files in a console? Sometimes
it works there to access files which Windows cannot handle.

(Windows 98 had the bug that every file with an ASCII 255-
character in the filename was not accessible by any program.
You could rename any file in the MSDOS-Command with this
character and you could rename it back there)

Moormaster, I can't remember if I tried using scandisk to
recover the file, but that is beside the point. The issue is that
such filenames are illegal in FAT, and Rockbox should aim to
prevent users doing things to the filesystem which are illegal
(just as Windows, Linux and any other operating system
should). Using Scandisk or some other Windows utility might
be a workaround, but it would be much better to have Rockbox
avoid creating the illegal filename in the first place.


I'm sure that "filename." is a valid FAT filename, in the
same way that ".rockbox" is valid as a folder name.

The problem is actually that Windows is too "stupid" to
allow you to create these filenames, hence we need to use
DOS (or a decent O/S like Linux) to create the directory
under Windows.

From the FAT32 File System Specification (page 29):

"Leading and embedded periods are allowed in a name and are
stored in the long name. Trailing periods are ignored."

I think this is a bit ambiguous, but I suspect what they mean
is that trailing periods should be ignored (stripped) on write,
and not stored as part of the long filename. It seems that
Windows then never expects a trailing period when reading a
filename. So ".rockbox" is a legal FAT32 name, even if you
have to use a command line rather than Windows Explorer to
create it, while "rockbox." is not legal. At any rate, it strongly
suggests that a dot right at the end might be more
problematic than one at the start or in the middle of the name.
If Linux or rockbox or any other operating system is more
tolerant of badly created names than Windows, that's fine by
me, but no operating system should knowingly allow badly
formed names to be created.

So my suggestion is simply that Rockbox should prevent
creation of file names with trailing dots, which is what I think
the FAT32 spec calls for.

Project Manager
zagor commented on 2004-01-14 08:50

I agree, the fat code should not allow filenames that are
incompatible with the FAT32 specification. This includes
checking for illegal characters, which we don't do today

Attaching a patch that adds a filename sanity-checking
function to the fat driver. Currently it only checks if the
last character is '.', but more checks can (and should)
easily be added.

Updated patch that puts the check in the right place (I
hope). Previously I was using it from fat_rename directly,
but doing it in add_dir_entry seems like the right place,
such that any function that creates things should benefit
from this.

The function still just checks for filenames ending in a
period though.

I just committed my patch that prevents filenames ending in
periods. Additional checks for filename validity can
relatively easy be added.

Closing this bug. Reopen if the commit is reverted.


Available keyboard shortcuts


Task Details

Task Editing