My Oracle Support Banner

Why does the order of files listed in a directory change (Doc ID 1606342.1)

Last updated on MARCH 08, 2021

Applies to:

Solaris Operating System - Version 8 6/00 U1 and later
Information in this document applies to any platform.


 Some Application or process which previously read directory entries from a particular directory in one order may read them in a different order which may break applications or processes which are dependent upon the order which entries are returned from the directory listings.

The actual order of directory entries being returned from the file system can be observed using truss with

## The -vall option to truss prints out the contents of the structures returned by the system call which shows the raw order returned by the system

## this uses the ls command but other applications can be used if they read directory entries using getdents system call

$ truss -vall -tgetdents ls -al > /dev/null
getdents64(3, 0xFF384000, 8192)                 = 264
   ino=1461835 off=12   rlen=24  "."
   ino=1461824 off=24   rlen=24  ".."
   ino=1461836 off=36   rlen=24  "1a"
   ino=1461837 off=48   rlen=24  "1b"
   ino=1461838 off=60   rlen=24  "1c"
   ino=1461839 off=72   rlen=24  "2c"
   ino=1461840 off=84   rlen=24  "2b"
   ino=1461841 off=96   rlen=24  "2a"
   ino=1461842 off=108  rlen=24  "3a"
   ino=1461843 off=120  rlen=24  "3b"
   ino=1461844 off=512  rlen=24  "3c"
getdents64(3, 0xFF384000, 8192)                 = 0





 Changes may include changes in file system used, changes made to the directory , the directory being recreated , patches being applied or possibly no changes at all.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document
 Standard Organizations and Standards:
 Standards covering reading directory entries:

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.