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

Re: Detecting new mail in mbox format



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday, April 23 at 11:17 PM, quoth Chris G:
> I know mutt detects new mail in mbox format by comparing the last 
> access time with the modification time of the file.  However I can't 
> find anywhere that tells me the exact logic.
>
> In particular if the last access time is the *same* as the 
> modification time does mutt treat the mailbox as having new mail or 
> not?

The logic is defined in buffy.c:

     sb.st_mtime > sb.st_atime || (tmp->newly_created && sb.st_ctime ==
     sb.st_mtime && st.st_ctime == sb.st_atime)

Essentially, a mailbox is considered to have new mail if either the 
modification time is newer than the access time OR it appears to have 
been newly created, and the change time is equal to the modification 
time and to the access time.

> On my system (Ubuntu 8.10) it seems impossible to create a file with 
> an access time before the modification time. One can *add* to an 
> exisitng mailbox and set the modification time later than the access 
> time but one cannot *create* a new mbox file with access before 
> modification.

That makes sense to me...

Of course, personally, I think recording access time (thereby turning 
every disk access into a disk write) is a waste of my computer's time, 
so I usually mount my filesystems with the "noatime" option. But then, 
I also use Maildir instead of mbox, because it avoids lots of this 
kind of silliness (it's also a more well-defined mailbox format).

~Kyle
- -- 
Holding on to anger, resentment and hurt only gives you tense muscles, 
a headache and a sore jaw from clenching your teeth. Forgiveness gives 
you back the laughter and the lightness in your life.
                                                         -- Joan Lunden
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iEYEARECAAYFAknw9iIACgkQBkIOoMqOI17Q1QCgj5jXNPycnHsVG6FELP+ZKPqG
eiwAoMZp1HDiizfTfoqtJilP+RXcrn5e
=5WlN
-----END PGP SIGNATURE-----