Bug in sophie-3.04rc2

Richard Gilbert <[email protected]> Mon, 4 Apr 2005 15:29:50 +0100 (BST)
Newsgroups gmane.mail.exim.exiscan.user
Organization University of Sheffield
Message-ID <[email protected]>
I have found a problem with sophie-3.04rc2.  This is surprising 
considering it has been used unchanged for well over a year by a very 
large community of satisfied users, ourselves included, to scan probably 
billions of messages!

I installed my standard setup on a new Sun V20Z Linux system.  The full 
details are given below but the crucial factor is that it is running a 
journaling file system: Ext3 file system on a LVM (Logical Volume Manager) 
partition.  Sophie assumes that the first two entries returned by readdir 
will be '.' and '..'.  With this file system this is not the case, leading 
to sophie trying to scan dirname/../dirname/../dirname/../...

The fix I have applied is simple:

# diff sophie_scandir.c.orig sophie_scandir.c
36,39d35
<       /* Let's get rid of '.' and '..' */
<       direntry = readdir(dirpt);
<       direntry = readdir(dirpt);
<
41a38,42
>               /* Ignore '.' and '..' */
>               if (strcmp(direntry->d_name, ".") == 0 ||
>                   strcmp(direntry->d_name, "..") == 0)
>                       continue;
>

I am not a C programmer, so there may be a more elegant way of doing this.

Richard
--
Richard Gilbert
Corporate Information and Computing Services
University of Sheffield, Sheffield, S10 2TN, UK
Phone: +44 114 222 3028   Fax: +44 114 222 3040

$ uname -a
Linux beaver.shef.ac.uk 2.6.9-5.0.3.ELsmp #1 SMP Mon Feb 14 10:03:50 EST 2005
i686 athlon i386 GNU/Linux

$ cat /proc/version
Linux version 2.6.9-5.0.3.ELsmp ([email protected])
(gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)) #1
SMP Mon Feb 14 10:03:50 ESeion

Ext3 file system on a LVM partition