mailbox.mbox.add() sets access time as well as modification time

MRAB google at mrabarnett.plus.com
Fri Apr 24 17:05:41 CEST 2009


Grant Edwards wrote:
> On 2009-04-23, MRAB <google at mrabarnett.plus.com> wrote:
>> tinnews at isbd.co.uk wrote:
>>> It seems to me that mailbox.mbox.add() sets the access time of a mbox
>>> file as well as the modification time.  This is not good for MUAs that
>>> detect new mail by looking to see if the access time is before the
>>> modification time.
>>>
>>> Have I done something wrong somewhere or is mailbox.mbox.add() really
>>> as broken as it would appear?
>>>
>> [snip]
>> The access time is the time it was last accessed, ie read or modified.
> 
> Usually.
> 
>> The modification time is the time it was last modified.
> 
> Usually.
> 
>> The access time can never be before the modification time because it
>> must be accessed in order to be modified!
> 
> Nonsense.  You can set atime and mtime to anything you want.
> 
Well, yes, you can always change atime and mtime and make it look like
something happened at a different time to when it actually happened...

> SOP for writing to to an mbox formatted mailbox is to preserve
> the atime (changing only the mtime) so that other programs know
> that that there is "new" mail in the mbox.  I know mutt works
> that way, and I believe that the "you've got new mail" features
> in some shells work that way.  AFAIK, atime<mtime has been the
> "standard" way to determine when an mbox contains new mail for
> at least 20 years.
> 
So atime is used to indicate when it was last read, not last accessed?
Hmm...

> Anybody writing to an mbox mailbox has to follow the rules if
> they expect to interoperate with other mail applications.  If
> mailbox.mbox.add() doesn't preserve the atime when writing to
> an mbox, then mailbox.mbox.add is broken.
> 
> http://www.qmail.org/qmail-manual-html/man5/mbox.html
> 




More information about the Python-list mailing list