Something is fishy with get_dir(). I had a directory with 232 directories in, where get_dir() returned an empty array. Adding a directory fixed it to return the correct result. ls had no problems, and when tracing get_dir() syscalls it looks like it gets the correct things back:
Non-working;: open(".", O_RDONLY) = 7 fpathconf(7, _PC_NAME_MAX) = 255 fcntl(7, F_SETFD, 0x00000001) = 0 fstat(7, 0xFFFFFD7FFFDF9AB0) = 0 getdents(7, 0xFFFFFD7FFEEE4000, 8192) = 8168 getdents(7, 0xFFFFFD7FFEEE4000, 8192) = 1160 getdents(7, 0xFFFFFD7FFEEE4000, 8192) = 0 close(7) = 0
Working after adding dirs: open(".", O_RDONLY) = 7 fpathconf(7, _PC_NAME_MAX) = 255 fcntl(7, F_SETFD, 0x00000001) = 0 fstat(7, 0xFFFFFD7FFFDF9AB0) = 0 getdents(7, 0xFFFFFD7FFEEE4000, 8192) = 8176 getdents(7, 0xFFFFFD7FFEEE4000, 8192) = 1224 getdents(7, 0xFFFFFD7FFEEE4000, 8192) = 0 close(7) = 0
root:~# /usr/local/bin/pike --dumpversion 7.8.116 root:~# uname -a SunOS ministore 5.11 snv_101b i86pc i386 i86pc
Interesting; do you think you could reproduce the problem with a pike compiled with READDIR_DEBUG (src/modules/files/efuns.c)?
I'll try. In this case I had to destroy the working test case since it's in a live environment, but I know the names of all the directories and hope that is enough to recreate it.
The compilation failed, so I'll have to take another look at the debug option tomorrow, but at least this reproduces it on my test machine with 7.8.116:
/* No attempt has been made to reduce this further. */ void main() { mkdir("test");
string foo = "x"*17; string bar = "y"*18; for(int i=0; i<68; i++) mkdir( "test/"+ (i + foo)[0..16] ); for(int i=0; i<164; i++) mkdir( "test/"+ (i + bar)[0..17] );
if( sizeof(get_dir("test")) != 68+164) werror("Fail!\n"); }
Well, I can't reproduce it with the same release on Debian gutsy either. clib implementation details probably matter. I'm happy enough grubba can reproduce it on Solaris.
pike-devel@lists.lysator.liu.se