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

Grant Edwards invalid at invalid
Fri Apr 24 14:07:57 EDT 2009


On 2009-04-24, MRAB <google at mrabarnett.plus.com> wrote:

>>> [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...

Yup.  And that's what one does when writing to an mbox format
mailbox.

>> 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...

Unfortunately, that's how mbox works.  It's an ugly hack, but
if one didn't care about backwards-compatiblity with old e-mail
apps, then one would use a less broken mailbox format like
maildir.

-- 
Grant Edwards                   grante             Yow! I smell like a wet
                                  at               reducing clinic on Columbus
                               visi.com            Day!



More information about the Python-list mailing list