[Samba] Sorting directory lists (again)

Andy Kelk andykelk at gmail.com
Sun Dec 28 21:52:25 GMT 2008


Hello list,

I know this has been discussed before (June 2007 looks to be the most
recent time), so apologies for covering (sort of) old ground.

The lowdown is that samba uses readdir to get its directory listing
and this is returned in whatever order the filesystem sees as
appropriate (using ext3, it seems to be related to mtime). I have a
device which accesses a share using CIFS and presents the files in the
order that they are returned by the server. This works fine using NTFS
on Windows XP (as that filesystem returns the files alphabetically)
but ends up in a confusing list when accessing the ext3 share.

I understand that it's not a good default for Samba to do the sorting
(as mostly it's not needed - the client can do it), but I'd love to
have an option for an individual service to return a sorted directory
list (accepting the performance hit that it would incur). Is this
something that would be included in a future Samba release?

I guess another alternative would be to have a Samba VFS that sorts
the readdir output before passing it on. Can anyone comment on this as
a possible solution and whether it has been accomplished before?

Any thoughts or comments would be much appreciated.

Andy


More information about the samba mailing list