Alain.Gorlier@altissemiconductor.com
2007-Jun-11 13:54 UTC
[Samba] directory list is not alphabetically sorted
Hi, Created some files and directories on a Samba 3.0.22 Linux server from an Windows Samba client using this chronological order : cc aa zz bb yy ww rr ss tt (directory) mm (directory) oo (directory) jj (directory) The directory list on Windows Samba client (via dir command without any options) shows the following: Y:\toto>dir Volume in drive Y is MXX Volume Serial Number is 12E4-00F3 Directory of Y:\toto 11/06/2007 15:18 <DIR> . 11/06/2007 15:01 <DIR> .. 11/06/2007 15:01 12 zz 11/06/2007 15:18 <DIR> oo 11/06/2007 15:00 11 cc 11/06/2007 15:18 <DIR> jj 11/06/2007 15:04 9 rr 11/06/2007 15:18 <DIR> mm 11/06/2007 15:04 12 ss 11/06/2007 15:03 11 ww 11/06/2007 15:01 13 aa 11/06/2007 15:03 16 yy 11/06/2007 15:01 9 bb 11/06/2007 15:18 <DIR> tt 8 File(s) 93 bytes 6 Dir(s) 2 609 844 224 bytes free Same behaviour with an OS2 Samba client. Using an OS2 Lan server instead Linux Samba server, the dir command without any option, show an alphabetically sorted list across files and directories. Some applications rely on this alphabetical order. (for good or bad reasons...) Is there a way to recover the same behaviour ? Using the ls -l command on the linux fileserver, the directory list is alphabetically sorted : (just what we want) [B2:fsetssd1l1:root] > ls -l total 48 -rwxrwxr-x 1 ADMINOCS shetssgrp 13 jun 11 15:01 aa -rwxrwxr-x 1 ADMINOCS shetssgrp 9 jun 11 15:01 bb -rwxrwxr-x 1 ADMINOCS shetssgrp 11 jun 11 15:00 cc drwxrwxr-x 2 ADMINOCS shetssgrp 4096 jun 11 15:18 jj drwxrwxr-x 2 ADMINOCS shetssgrp 4096 jun 11 15:18 mm drwxrwxr-x 2 ADMINOCS shetssgrp 4096 jun 11 15:18 oo -rwxrwxr-x 1 ADMINOCS shetssgrp 9 jun 11 15:04 rr -rwxrwxr-x 1 ADMINOCS shetssgrp 12 jun 11 15:04 ss drwxrwxr-x 2 ADMINOCS shetssgrp 4096 jun 11 15:18 tt -rwxrwxr-x 1 ADMINOCS shetssgrp 11 jun 11 15:03 ww -rwxrwxr-x 1 ADMINOCS shetssgrp 16 jun 11 15:03 yy -rwxrwxr-x 1 ADMINOCS shetssgrp 12 jun 11 15:01 zz Why does Samba & Linux not show the same order ? Regards,
Alain.Gorlier@altissemiconductor.com
2007-Jun-14 15:42 UTC
[Samba] directory list is not alphabetically sorted
No idea on this point ?
On Thu, Jun 14, 2007 at 05:42:06PM +0200, Alain.Gorlier@altissemiconductor.com wrote:> No idea on this point ?Not really. Samba just does not sort the directory before shipping it to the client. For huge directories this would be way too expensive. We could certainly implement this, but so far we have viewed directory sorting to be a client task, and we got away with it pretty well. If critical applications change under that behaviour, our view might change though. Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20070614/3a0cc190/attachment.bin
Alain.Gorlier@altissemiconductor.com
2007-Jun-14 16:33 UTC
[Samba] directory list is not alphabetically sorted
> Not really. Samba just does not sort the directory beforeshipping it to the client. For huge directories this would be way too expensive. We could certainly implement this, but so far we have viewed directory sorting to be a client task, and we got away with it pretty well. If critical applications change under that behaviour, our view might change though. Since we have Windows and OS2 application viewers of huge directories, it impacts our users. They have now to scroll big number of pages or use search functions with patterns multiple times. There are not critical applications, but it is a bit of pain for users. Anyway, is there a rule of the way samba server lists filenames ? If we stop/start samba server, the directory list order is kept, so it sounds like there is a rule, but which ? Thanks,