<<< Date Index >>>     <<< Thread Index >>>

Re: access time changes when saving mbox with deleted messages



Hi,

Vincent Lefevre wrote:

> On 2004-03-18 19:28:39 +0100, Thomas Glanzmann wrote:
> > I guess the that the access/modification times are restored so that new
> > mailcheckers like xbiff don't trigger a 'new eMail' when you read your
> > messages.
> 
> IMHO, this should be optional since
>   * not all mailboxes are incoming boxes,
>   * in practice, this doesn't always work (because of the race
>     condition?),
>   * these mailcheckers could be fixed to use a more robust method.

Here we go.  Attached is a patch, that adds $mbox_keep_mtime to mutt.
When set, the old behavior is used.
When unset, mtimes are not restored on mbox files.

The patch could be better, because I only inhibit the actual
restauration of the mtime.  You could also inhibit the saving of the
mtime (look for usage of statbuf in mbox.c:mbox_sync_mailbox()), but I
wasn't sure about side effects.

Any comments?
 
> Anyway, using the maildir format (and a wrapper for version control)
> could be a better idea.

Not if only one single mbox file is affected (as on my system).

Ciao,
Viktor
-- 
!!! Listen live to reboot.fm !!!
 
Tune in to 104.10 MHz if you're in Berlin, Germany or listen to the internet
stream at http://www.reboot.fm/stream/ .
diff -ur mutt-1.5.5.1/init.h mutt-1.5.5.1.vrr/init.h
--- mutt-1.5.5.1/init.h 2003-11-05 10:41:32.000000000 +0100
+++ mutt-1.5.5.1.vrr/init.h     2004-03-18 20:57:56.611362136 +0100
@@ -1024,6 +1024,15 @@
   ** This specifies the folder into which read mail in your ``$$spoolfile''
   ** folder will be appended.
   */
+  { "mbox_keep_mtime", DT_BOOL, R_NONE, OPTMBOXKEEPMTIME, 0 },
+  /*
+  ** .pp
+  ** If set, mutt will not change the the modification time of an mbox
+  ** file if mails are only deleted from the file.  If unset, mutt will
+  ** modify the modification time.  This is necessary for some version
+  ** control files such as svn, but may confuse some xbiff style mail
+  ** checkers.
+  */
   { "mbox_type",       DT_MAGIC,R_NONE, UL &DefaultMagic, M_MBOX },
   /*
   ** .pp
Nur in mutt-1.5.5.1.vrr/: .init.h.swo.
diff -ur mutt-1.5.5.1/mbox.c mutt-1.5.5.1.vrr/mbox.c
--- mutt-1.5.5.1/mbox.c 2003-11-05 10:41:32.000000000 +0100
+++ mutt-1.5.5.1.vrr/mbox.c     2004-03-18 20:59:10.503128880 +0100
@@ -935,10 +935,12 @@
     return (-1);
   }
 
-  /* Restore the previous access/modification times */
-  utimebuf.actime = statbuf.st_atime;
-  utimebuf.modtime = statbuf.st_mtime;
-  utime (ctx->path, &utimebuf);
+  if (option(OPTMBOXKEEPMTIME)) {
+    /* Restore the previous access/modification times */
+    utimebuf.actime = statbuf.st_atime;
+    utimebuf.modtime = statbuf.st_mtime;
+    utime (ctx->path, &utimebuf);
+  }
 
   /* reopen the mailbox in read-only mode */
   if ((ctx->fp = fopen (ctx->path, "r")) == NULL)
diff -ur mutt-1.5.5.1/mutt.h mutt-1.5.5.1.vrr/mutt.h
--- mutt-1.5.5.1/mutt.h 2003-11-05 10:41:32.000000000 +0100
+++ mutt-1.5.5.1.vrr/mutt.h     2004-03-18 20:58:14.609625984 +0100
@@ -373,6 +373,7 @@
   OPTMAILDIRTRASH,
   OPTMARKERS,
   OPTMARKOLD,
+  OPTMBOXKEEPMTIME,    /* keep mtime? */
   OPTMENUSCROLL,       /* scroll menu instead of implicit next-page */
   OPTMETAKEY,          /* interpret ALT-x as ESC-x */
   OPTMETOO,

Attachment: signature.asc
Description: Digital signature