Rockbox

Tasklist

FS#1573 - Should prevent saving "filename."

Attached to Project: Rockbox
Opened by Barry McIntosh (combthins) - Sunday, 03 August 2003, 09:59 GMT
Last edited by Jonas Häggqvist (rasher) - Wednesday, 07 September 2005, 02:08 GMT
Task Type Bugs
Category Drivers
Status Closed
Assigned To Jonas Häggqvist (rasher)
Operating System
Severity Medium
Priority High
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

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-
20030801.
This task depends upon

Closed by  Jonas Häggqvist (rasher)
Wednesday, 07 September 2005, 02:08 GMT
Reason for closing:  Fixed
Additional comments about closing:  Logged In: YES
user_id=231381

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.
Comment by Andre Herbst (moormaster) - Monday, 22 December 2003, 22:53 GMT

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)
Comment by Barry McIntosh (combthins) - Sunday, 28 December 2003, 17:13 GMT

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.

CombThins
Comment by Mike Holden (mikeholden) - Sunday, 28 December 2003, 19:07 GMT

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.
Comment by Barry McIntosh (combthins) - Sunday, 28 December 2003, 22:57 GMT

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.
Comment by Björn Stenberg (zagor) - Wednesday, 14 January 2004, 08:50 GMT

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
either.
Comment by Jonas Häggqvist (rasher) - Saturday, 27 August 2005, 15:03 GMT

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.
Comment by Jonas Häggqvist (rasher) - Monday, 29 August 2005, 21:58 GMT

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.
Comment by Jonas Häggqvist (rasher) - Wednesday, 07 September 2005, 02:08 GMT

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.

Loading...