Hello!
After a little bit of thinking and coding I came up with this perl script
to solve the problems I raised on mailbox access times, and some other
more.
I've been using this thing from a couple of days and it seems to get the
job done, but I'd like some peer review.
The script addresses two problems:
1) If some non-mail-aware utility like grep, glimpse or whatever is used
on the mailboxes, access times are altered and mutt looses informations
about what mail is new, and if there is new mail at all.
The script preserves this information between mutt runs, so that
useful utilities can be used on the mailboxes.
2) When a mailbox is modified my mutt (for example when setting some
messages as 'read'), its modification time is not changed. This gives
some problem to file synchronization programs like unison, that fail
to see the file as changed.
The script can detect if a mailbox has been changed by mutt after it
has run, and alter its mtime to notify synchrony and backup software
about the changes. That mtime is then restored to the value wanted
by mutt during the next mutt invocations.
Being it smaller, I attach it to this e-mail. I ask to the people with
the same problems that I have to please have a look at it.
The script can do many actions on the mailboxes (most of them were testing
features), but the two useful ones are the 'before' and 'after' ones, to
be used as in this script I'm now using to run mutt:
#!/bin/sh
cd ~/Mail
./.fixtimes -a before *
cd -
mutt
cd ~/Mail
./.fixtimes -a after *
(I prepended a dot to the script to avoid mutt considering it a mailbox)
fixtimes stores the data it uses in files in the form:
.<mailbox-name>.{atime,ft}
so don't be scared if you find lots of them scattered in your mailbox
after you run the script.
Little warning: fixtimes does not change the contents of the mailboxes at
all, just their atime and mtime. However, there was the possibility that
at the first run the atimes and mtimes were reset, losing informations
about the new mail (but not losing the new mail). I fixed this, but I did
not test well enough the fix, so you may find yourself in mutt with all
mailboxes marked 'N' the first time you use it.
Right now, I'm pretty fine with the script and I thought I'd share it.
If the ideas in it are valid, perhaps something could be integrated in
mutt (especially the detection of changed mailboxes, that mutt can do
more efficiently being the one who changes them).
I'm at your disposal for help, improvements, and hearing criticisms and
feedback.
Ah, yes, I nearly forgot to say that this is of course a bad and crude
hack.
Bye, Enrico
--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini (Unibo) <[EMAIL PROTECTED]>
fixtimes.gz