What is the case for preserving case under Samba ...

Conrad Minshall conrad at apple.com
Mon Jul 8 01:14:02 GMT 2002

At 12:54 AM -0700 7/8/02, Richard Sharpe wrote:

>It's not really an issue for Samba. It is an issue for the file system.
>Samba is another client of the file system, and it would be nice for
>Samba to be able to say:
>  Give me a case-preserving but non-case sensitive view of the file
>  system.

However this would be done, practicality demands it work with existing
(on-disk) filesystems and existing wire protocols.  New filesystems need
not apply.

Case-folding from the client character set point-of-view may be different
than in the character set Samba sees in our local filesystem.  Samba loses
control of this by pushing the problem down into the OS, but OK, the
abstraction is nice, and once everything is unicode a universal definition
of case-folding is at least possible.

The case-sensitive namespace is larger, so mapping to a case-insensitive
one is inherently lossy.  My wish is for a mapping to break down in a
deterministic fashion - something predictable by a sufficiently smart
application which has no knowledge of the file system beyond its current
state as visible via posix apis.  Proof that this determinism is or is not
possible would be interesting.

>The problems that arise are how do you deal with:
>  UNIX user creates file foo.txt
>  CIFS client opens FOO.TXT and the file system maps that to foo.txt
>  CIFS client uses the file and closes it.
>  UNIX user now creates file FOO.TXT
>  CIFS client opens FOO.TXT again. Which file does it get?

The client "now" may be unrelated to the client "earlier" (same client but
different context).  So a reasonable and deterministic answer is to prefer
case-correct matches over folding, ie give the client the nice new FOO.TXT.
But the problem gets uglier when there is no case-correct match, but
multiple case-insensitive matches do exist.

An interesting comment on case-insensitivity is in the Rationale for the
standard-previously-known-as-posix.  Xopen requires registration so the
following link probably won't work as is:

Conrad Minshall, conrad at apple.com, 408 974-2749
Apple Computer, Mac OS X Core Operating Systems

More information about the samba-technical mailing list