Package: wmmaiload
Version: 1.0.2-1
Severity: minor
Tags: patch

When checking for new mail in an MBOX folder, wmmaiload continuously resets
the atime of the respective file. This breaks MUAs which check for new
mail with a comparison of the access time of a folder with the date of
the messages contained within.

Could you please consider the attached patch to fix this behavior?
It alters the `check_mbox' routine to prefetch the atime of an mbox folder
with stat(2), allowing for a simple atime reset after the mail check.


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (700, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13.2-maia
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages wmmaiload depends on:
ii  libc6                     2.3.5-6        GNU C Library: Shared libraries an
ii  libglib1.2                1.2.10-10      The GLib library of C routines
ii  libgtk1.2                 1.2.10-17      The GIMP Toolkit set of widgets fo
ii  libx11-6                  6.8.2.dfsg.1-7 X Window System protocol client li
ii  libxext6                  6.8.2.dfsg.1-7 X Window System miscellaneous exte
ii  libxi6                    6.8.2.dfsg.1-7 X Window System Input extension li
ii  libxpm4                   6.8.2.dfsg.1-7 X pixmap library
ii  xlibs                     6.8.2.dfsg.1-7 X Window System client libraries m

wmmaiload recommends no packages.

-- no debconf information
--- wmmaiload-1.0.2.orig/src/main.c
+++ wmmaiload-1.0.2/src/main.c
@@ -704,7 +704,8 @@
 #ifdef HAVE_MBOX
 static Bool check_mbox(MailBox *box, time_t now) {
     FILE *file;
-    /*struct utimbuf u;*/
+    struct utimbuf u;
+    struct stat s;
     char line[MAXSTRLEN + 1];
     int  nbmails     = 0;
     int  nbreadmails = 0;
@@ -717,7 +718,9 @@
         box->time = 0;
         box->size = 0;
     }
-    if (!fexist(box->entry) )                                     return False;
+    if (stat(box->entry, &s) == -1)                               return False;
+    u.actime  = s.st_atime;
+    u.modtime = s.st_mtime;
     if (!test_size && !filetime(box->entry, &(box->time), CTIME)) return False;
     if (test_size && !filesize(box->entry, &(box->size)))         return False;
     if ((file = fopen(box->entry, "r")) == NULL)                  return False;
@@ -742,11 +745,7 @@
     box->new     = nbmails - nbreadmails;
     box->total   = nbmails;
     box->updated = force;
-    /*
-    u.actime  = box->atime;
-    u.modtime = box->mtime;
     utime(box->entry, &u);
-    */
 
     return True;
 }

Reply via email to