Re: Long file names in VFAT broken with iocharset=utf8

Albert Cahalan
2007-05-09T23:49:57Z

On 5/9/07, Andrey Borzenkov <arvidjaar@mail.ru> wrote:
> On Wednesday 09 May 2007, Albert Cahalan wrote:
...
>>> On May 8 2007 00:43, Albert Cahalan wrote:

>>>> Fix: the vfat driver should use the 8.3 name for such files.
...
>> It's not appropriate for vfat, HPFS, JFS, or NTFS. All of those
>> have built-in support for 8.3 aliases. Normally the 8.3 names
>> are like hidden hard links, except that deletion of either name
>> will wipe out the other. (same as case differences too)
>> So the names are there, and they should already work.
>> They just need to be reported for directory listings when the
>> long names would be too long.
>
> several problems associated with it
>
> 1. those names are rather meaningless. How do you find out which file they
> refer to? It is OK for trivial cases but not in a directory full of long
> names; nor am I sure how many unique short names can be generated.

If a short name can not be generated, then no OS could
create the file at all. The vfat and iso9660 filesystems require
short names. Any OS writing to such a filesystem MUST
generate short names in addition to any long names.
Mount your vfat as filesystem type "msdos" to see.

By default, Windows will also generate short names on NTFS.

Note that you can't put your files on a CD-ROM in a way
that Windows could read the filenames. Windows limits
CD-ROM filenames to 63 characters; you get at most 103
if you violate the spec.

> 2. directory contents is effectively invalidated upon backup and restore (tar
> c; rm -rf; tar x). It is impossible to infer long names from short ones.

It may be that tar fails to use the vfat ioctl calls to save
and restore short names. You could try using Wine to
run a Windows-native backup program. This shouldn't
really matter though; you'd only be getting short names
for files that had truly unreasonable long names anyway.

I suppose somebody should check to see if there is a
danger of overwrite when the short-named files get
written back. The safest thing might be to mount the
filesystem as type "msdos".

> 3. this still does not answer how can I *create* long name from within Linux.

WTF? These names are too annoying to use, even if there
weren't this limit. Anything over about 29 characters is in
need of a rename. (that'd be 58 bytes for you, which is OK)
The limit is already 4 times larger than what is reasonable.