Rockbox mail archive
Subject: FAT Filename Mangling bug. (was: RE : Regarding the recent recording PANIC's)
From: Michael O'Quinn (michael_at_oquinn.info)
On Thu, 24 Apr 2003, Björn Stenberg wrote:
> SeeSchloß wrote:
> > But short names should have the same extension as the long name...
> No, the shortnames must only be unique in the directory. Remember that a
> dir can have files called a.big.file and a.bigextension. How do you give
> those shortnames the same extension as their longname?
> Short names are only ever seen in older operating systems that don't
> support long names. Such old systems don't support USB either, so it's
> not an issue for Rockbox.
There are specific mapping rules that are defined for mangling long names
into short. And if it's FAT (of whatever flavor) the short names are
THERE, even if the OS normally hides them
Here's what Micro$oft says in the Windoze-98 Resource Kit...
=====[ BEGIN ]===== =====[ BEGIN ]===== =====[ BEGIN ]=====
Long File Name Support in Windows 98
For every long file name, an alias entry is generated automatically that
complies with the 8.3 file name rules for backward compatibility.
Automatically generated aliases are composed of the first six characters
of the file name plus ~n (where n is a number) and the first three
characters after the last period. So the file name ThisIsALong.File.Name
is associated with the automatically generated alias THISIS~1.NAM. If the
alias name already exists, the algorithm will generate a unique value for
Neither the user nor an application can control the name created by the
automatic alias process. Related issues are discussed in “Long File Names
and Network Compatibility” later in this chapter.
For the file name to comply with the 8.3 file name rules, it must use only
the valid characters for an alias and it must be all uppercase. Valid
characters for 8.3 file names (and aliases) can be any combination of
letters and numbers, a space (ASCII 20H), ASCII characters greater than
127, and the following special characters:
$ % ' - _ @ ~ ` ! ( ) ^ # &
The following additional characters are valid in long file names, but are
not valid in alias names or 8.3 file names:
+ , ; = [ ]
The following rules also apply for Windows 98 file systems:
Maximum file name component length is 255 characters,
Maximum path length is 260 characters, including NULL
(compared to 80 characters for a short name).
The OEM character set used by the installable file
system (IFS) is determined by the registry and the
contents of the file Unicode.bin.
The long file name directory entries use the Unicode
character set to store the names.
The file name and the alias are the same if the file name meets 8.3 file
name rules (that is, if it contains only valid characters for an alias and
it is all uppercase). This means that a file name using only valid
characters for an alias and following the 8.3 file name format is still
not the same as the alias name if it contains lowercase characters.
However, in this case the alias is the uppercase version of the file name.
For example, if the long file name is Examples.txt, its alias is
EXAMPLES.TXT. The case is preserved in the long file name. (Note, though,
that path-based APIs in the Windows 98 file system are not case-sensitive.
So a search of the form “EXAMPLES.TXT” or “Examples.txt” will find the
To see the alias for a file, right-click the file in any shell program
such as Windows Explorer, and then select Properties from the context
menu. The value for MS-DOS Name in the General Properties dialog box shows
the alias assigned to this file. Also, the dir command at the command
prompt shows the long file name.
=====[ END ]===== =====[ END ]===== =====[ END ]=====
I couldn't find in Microsoft's docs where it says what terrible things
will happen if some other OS creates files and fat entries that violate
thses rules. (Other Operating Systems? WHAT other Operationg Systems.
There ARE no other Operating Systems that We At Microsoft are aware of...)
But this does affect the ability to open the file from WIndoes 98, and it
also confuses JBSync when it sees a new playlist created by RockBox.
I don't know it this has anything to do with the Recording PANICS, but it
is worthy of it's own bug report.
I guess I just nominated myself to write one, eh?
Page was last modified "Jan 10 2012" The Rockbox Crew