Subject: Re: kern/4395: Bug in vfat generation number creation for msdosfs
To: Rick Byers <rickb@iaw.on.ca>
From: Dave Huang <khym@bga.com>
List: netbsd-bugs
Date: 11/14/1997 20:18:09
On Fri, 14 Nov 1997, Rick Byers wrote:
>         When a file is created who's short name allready exists (but has
>         a uniqe long filename), The short name is supposed to have it's
>         generation number increased by 1 (i.e. ~2).  This works fine under
>         NetBSD until generation 10 is reached.  Any generation above
>         9 doesn't get created properly.  Instead of FILEN~10, NetBSD sets
>         it to FILEN~0E.  When more than 60 files exist with the same short
>         name, the kernel gets caught because it cannot create an unique
>         short file name.

FWIW, Windows NT creates the short filenames differently. (And Windows 95
uses yet another method of making short filenames). According to the NT
Workstation 4.0 Resource Kit, page 580:

     When there are five or more files that would result in duplicate short
     filenames, Windows NT uses a slightly different method for creating
     short filenames. For the fifth and subsequent files, Windows NT:

     * Uses only the first two letters of the long filename.

     * Generates the next four letters of the short filename by
       mathematically manipulating the remaining letters of the long
       filename.

     * Appends ~1 (or another number, if necessary, to avoid a duplicate
       filename) to the result.

     This method provides substantially improved performance when Windows NT
     must create short filenames for a large number of files with similar
     long filenames. Windows NT uses this method to create short filenames
     for both FAT and NTFS volumes.

     For example, these are the long and short filenames for six files that
     you create in the order test 1 through test 6.

     Long filename          Short filename
     This is test 1.txt     THISIS~1.TXT
     This is test 2.txt     THISIS~2.TXT
     This is test 3.txt     THISIS~3.TXT
     This is test 4.txt     THISIS~4.TXT
     This is test 5.txt     TH0FF9~1.TXT
     This is test 6.txt     THFEF5~1.TXT

Ooh... mathematical manipulation :) Anyways, I don't have any opinion
on which is better. Just an observation...
--
Name: Dave Huang     |   Mammal, mammal / their names are called /
INet: khym@bga.com   |   they raise a paw / the bat, the cat /
FurryMUCK: Dahan     |   dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 22 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++