[PATCH] Fix Name mangling in HEAD

Simo Sorce idra at samba.org
Mon Mar 25 07:06:02 GMT 2002

On Mon, 2002-03-25 at 15:16, John E. Malmberg wrote:
> On Mon, 25 Mar 2002, Simo Sorce wrote:
> > Sorry, my mistake, windows use a little different scheme!
> > averyl~1.txt
> > averyl~2.txt
> > averyl~3.txt
> > averyl~4.txt
> > averyl~5.txt
> > avA4BD~1.txt
> > avA4FC~1.txt
> > avF3D6~1.txt
> > avAB5F~1.txt
> > avAB54~1.txt
> > 
> > windows use a week 16 bit number as hash and put it as a hex number in
> > the file name after the first 2 letters of the original name.
> Which version of windows?

I tested this with w2k

> Windows NT and Windows 95 do not use the same name mangling scheme.  And I
> do not know how many schemes there are in use by windows.
> Storing mangled names in a TDB only works if SAMBA is the only way that
> files in a directory get created, renameded or deleted.  Otherwise you
> need some sort of scheduled tasked to resynchronize them.

no tasked sync, in tdb we only save file<->mangled couples, if a new
file gets created we simply need to add a new association in the tdb,
unfortunately we may still have to make a scheduled task to delete
expired mapings on deleted files.

> But it appears that is the only portable way to permanently associate an
> 8.3 name with a long file name.
> I suppose symlinks would be much faster than a TDB, but who wants all
> those extra files to show up in a directory?  And files deleted, created,
> or renamed by other than SAMBA are still a problem.

No symlinks are not the way to go.

> Since there is no consistency in the Windows implementations of mangled
> filenames, there is no reason that SAMBA must comply with any of them,
> except that once a mangled name is associated with a real file name, that
> relationship must remain for the life of the real file name.

We would like to maintain ~1 thing to maintain maximum compatibility
towards apps that could check it to understand if a filename is mangled
or not.

> The faster the algorithm the better of course.

of course infact an hashing alghorithm seem required.

> Is the name mangling now being done in the default VFS layer, so that if a
> VFS understands how to maintain a mangled name, it can bypass the less
> efficient TDB method?

Not yet, but this is the plan, exactly for the reason to enable sustom
file backends that understand mangled names.


Simo Sorce
Una scelta di liberta': Software Libero.
A choice of freedom: Free Software.

More information about the samba-technical mailing list