begin  Andrew M. Bishop <[EMAIL PROTECTED]> wrote:
> [snip patch changing use of readdir() function]
>
> Can you tell me more about the operating system and file system that
> you are using WWWOFFLE on.

OS: Linux 2.6.0-test9
FS: ext3

Maybe this is since I added the dir_index feature to ext3, but I'm not
sure.

> I have never seen a file system where the first two entries in the
> directory structure are not "." and "..", yours is the first.  This is
> a little shortcut that has been in WWWOFFLE for a long time and it has
> always worked.  It appears in many more places than just in purge.c
> and they all need to be fixed.

#v+
$ cat lsdir.c
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>

int main(void)
{
   DIR *dir = opendir(".");
   struct dirent *e;
   
   if (dir == NULL) {
      perror("opendir");
      return EXIT_FAILURE;
   }
   
   while ( (e = readdir(dir)) != NULL )
     printf("%lu %u %s\n", e->d_ino, e->d_type, e->d_name);
   
   if (errno != 0)
     perror("readdir");
   
   closedir(dir);
   return EXIT_SUCCESS;
}
$ cd /var/cache/wwwoffle
$ /tmp/lsdir
324589 0 prevtime3
300921 0 prevout4
323231 0 lasttime
324390 0 prevout7
298391 0 temp
290305 0 .
293584 0 monitor
322866 0 prevtime7
306455 0 finger
323439 0 prevtime2
293166 0 html
299334 0 prevout1
298369 0 http
338713 0 ftp
302580 0 prevout3
379032 0 search
362902 0 outgoing
323014 0 prevtime6
323484 0 prevtime1
306433 0 local
300922 0 prevout2
298991 0 lastout
323738 0 prevtime5
324654 0 prevtime4
323113 0 prevout6
299339 0 prevout5
8065 0 ..
$ cd /var/cache/wwwoffle/ftp/
$ /tmp/lsdir 
340179 0 ftp.iks-jena.de
338790 0 ftp.uni-erlangen.de
338713 0 .
324736 0 ftp.kernel.org
339073 0 ftp.isi.edu
338780 0 download.sourceforge.net
338866 0 ftp.germany.net
338792 0 ftp.ac-grenoble.fr
338884 0 ftp.coda.cs.cmu.edu
177419 0 ftp.gwdg.de
338878 0 ftp.rfc-editor.org
56485 0 ftp.de.debian.org
290305 0 ..
194200 0 ftp.belwue.de
$ /var/
$ /tmp/lsdir
8065 0 cache
153217 0 run
145153 0 log
2 0 .
104833 0 backups
3866 0 lost+found
129025 0 local
169345 0 tmp
80641 0 lib
137089 0 lock
282241 0 mail
161281 0 spool
2 0 ..
#v-

As you can see it involves the whole filesystem.

I created a new ext3 filesystem. Without the dir_index feature I get the
order as you expect. But with the dir_index feature I get a skewed order.
So I would say this is a result of the dir_index feature of ext3.

J�rg.
end.
-- 
NetBSD ist f�r Frauen: es l�uft auf Waschmaschinen

Reply via email to