|Perl: the Markov chain saw|
Re: Is readdir ever deterministic?by ChemBoy (Priest)
|on Dec 17, 2001 at 23:54 UTC||Need Help??|
Does there exist a platform where readdir returns . and .. in other than the first two return values?
Yes! Though it took me three months after reading this question to realize it... or possibly something changed in the system setup during those three months. But in any event, I have an example case:
The files were created in the order 2,4,6,8,10,5,9,11 (you could say this was an artificial test case, I suppose...), but this does not seem to affect the sort order. The result is the same running on 5.004/Irix and 5.005/Linux: the key is seems to be the underlying filesystem, which is SGI XFS (under IRIX 6.5).
As a further (and yet more psychotically artificial) test, we have
I haven't done an exhaustive investigation of exactly what XFS does for all cases, but it seems fairly clear that one-character filenames will, in general, break the common assumptions of readdir on that filesystem.
If God had meant us to fly, he would *never* have given us the railroads.