> We rely on the usual sort order, observed generally
> on Unix and up to 6/06 in Solaris 10 too, but since
> we installed 11/06 on one SPARC system, the (default)
> sort order of directory entries returned by readdir
> seems to have changed. Is anything known about this?
> Does anybody need an example?
"sort order"? Readdir may return a specific order, but it is not "sorted".
Can you show an example of what you're getting? How are you calling readdir? What filesystem are you using? UFS, ZFS, or something else?
On UFS, readdir should return entries in "directory" order, based upon positioning within the directory. This is identical to what is returned from 'ls -f' within the directory. Without the -f, 'ls' itself is responsible for sorting.
# touch z 3 a 6 p
# ls -a
... 3 6 a p z
# ls -f
... z3a6p
# perl -e 'opendir(D,".");print join " ", readdir(D); print "\n";'
. .. z 3 a 6 p
ZFS uses hashing techniques rather than a linear list to maintain a directory. This improves performance in some situations, but means that the order returned is not necessarily the order that the files were created (but the order should be stable unless the directory is changed).
/tank/test# touch z 3 a 6 p
/tank/test# ls -f
... 6a3zp
/tank/test# perl -e 'opendir(D,".");print join " ", readdir(D); print "\n";'
. .. 6 a 3 z p
--
Darren