Daniel Berger <redmine / ruby-lang.org> wrote:
> I was expecting "1", in part because of the example from the pickaxe,
> and also because that's what JRuby returns. OS X 10.4 returns a simple
> index, too. However, I now see it's not necessarily just a simple
> index, depending on the platform.

Yes, readdir/telldir aren't guaranteed to have any ordering.  ext3
created with dir_index and ext4 (I think) do this to you, maybe others.

You can search for the spd_readdir LD_PRELOAD from Ted T'so
to get readdir() to sort by inode like you'd expect.  spd_readdir
can reduce disk seeks if you're iterating through a directory, too.

-- 
Eric Wong