Letter case not preserved

Fred Viles fv at episupport.com
Sun Nov 29 02:19:07 GMT 1998


On 22 Sep 98, at 11:28, Ben Kelley wrote about
    "Re: Letter case not preserved":

| > > All files transferred to my Samba server end up with lower case on the
| > > Unix box.  Case is not preserved from NT to Unix.  For example, if I
| > > copy C:\Temp\MyFile to a directory on the Samba server, it
| > > ends up there
| > > as myfile.
|...
| > Try preserve case = yes.  The default case for Samba is lower case (I
| > think) but that is configurable too (default case = upper)
|...
| I've come across this problem also. I have:
| 
|     mangle case = no
|     preserve case = yes
| 
| set, but all files seem to get created in lower case. Am I missing
| something?
|...

"preserve case" applies to "long" names.  There is a seperate option, 
"short preserve case", which is documented as controlling whether 
"short" names are converted to the default case or left alone.  

According to the docs, "short" names are all uppercase and within the 
8.3 DOS convention.  Since DOS and Windows 16-bit apps will always 
pass all filenames as uppercase, it can make a lot of sense to have 
"short preserve case = off" if you create files with DOS apps and 
then use them from Unix.  Otherwise (for example) all the source 
files you create with your DOS editor will be named SOURCE.C instead 
of source.c.

However, there appears to be a bug in the implementation of "short 
preserve case" (at least in 1.9.18p10).  Contrary to the docs, *all* 
8.3 names are forced to the default case, even mixed-case names.  
This is not what is wanted, IMO.

The following patch to server.c fixed this problem for me:

--- orig/server.c	Wed Aug 19 16:41:53 1998
+++ server.c	Fri Nov 27 22:36:18 1998
@@ -551,8 +551,13 @@
       pstrcpy(saved_last_component, name);
   }
 
-  if (!case_sensitive && 
-      (!case_preserve || (is_8_3(name, False) && !short_case_preserve)))
+  /*
+  ** force name to default case if desired.  !strhaslower() was added to
+  ** match docs - 8.3 names are not forced to default unless they are all
+  ** uppercase.
+  */
+  if (!case_sensitive && (!case_preserve ||
+      (!short_case_preserve && is_8_3(name, False) && !strhaslower(name))))
     strnorm(name);
 
   /* check if it's a printer file */




More information about the samba mailing list