On 16Oct2020 00:15, Ranjan Maitra <maitra(a)email.com> wrote:
On Fri, 16 Oct 2020 10:14:48 +1100 Cameron Simpson
<cs(a)cskk.id.au> wrote:
> Mostly the races.
>
> To add, remove or flag in MH probably requires a locking mechanism while
> updating the message number lists (and correspondingly, allocating new
> message numbers). You also don't know an arriving message is complete unless
> it isn't numbered yet; I imagine an MH insert goes
> save-completely-to-tempfile, allocate-number, rename-tempfile-to-number,
> update-number-lists. A lock would need to be held over the last three
> steps.
This may be a stupid question, but does this problem still happen if I use fetchmail to
pull mail and store messages in files via procmail?
Well, it is an issue regardless of the tool. procmail may do the initial
placement, but your mail reader probably moves messages around, if only
from one folder to another, which is the same task (new message in
target folder).
In my experience, messages have been given unique numbers in their
respective folders. (Of course, my MH is really not MH, but rather sylpheed-mh, since they
do not update the .mh_sequences but use .sylpheed_mark.
Well, the requirement for MH is of course that they have unique numbers
because their filenames are so named. The important thing is that
delivery tools cooperate - more than one tool might be trying to deliver
to the folder at once, and only one can work on the .mh_sequences or
.sylpheed_mark files at a time. So: locking.
Maildir lets you do this without locking because of the noncolliding filename
approach, and the "is this message file complete?" issue by doing all
preparation in the tmp subdir, before renaming the completed file into the
new subdir.
> Maildir is race free. Messages get unqiue filenames (composed of
various
> sufficently unique values combined), are created in the "tmp" subdir,
> and renamed into the "new" subdir. Read messages are renamed from
"new"
> to "cur". No shared number lists, no locks. You only look for messages
> in "new" and "cur".
Thanks very much for this. I have found a tool that can convert mh to mailbox:
https://github.com/vuntz/mh2maildir/blob/master/mh2maildir
It seems to work, but can not handle a second level of subfolders: brings them all out as
individual folders at the first level, so Ihave to fix that. Also, I don't like the
new folder names, seem too unnecessary for me. (I was expecting to the old MH folder names
inside my Maildir.) Also, the mails get stored as something like:
1602799622.116065_21187.hostname:2, not sure if this is the recommended way that files are
stored in the Maildir format. I was expecting to have something that I could have control
over.
Yah. I wrote one when I made this switch:
https://hg.sr.ht/~cameron-simpson/css/browse/bin/mh2maildir?rev=tip
Hmm, some years ago now, looking at the opening comment. And I'm using
procmail for the conversion (!!!), so indeed quite a while ago. This
script moves the MH folder sideways and makes an empty Maildir in its
place, then delivers every message from the MH folder into the new
maildir.
These days I'd use mutt for the bulk conversion instead of procmail. You can
see an example of that approach in this script:
https://hg.sr.ht/~cameron-simpson/css/browse/bin/mboxify?rev=tip
I have to look into this some more. I am not sure if this is the
standard way to store Maildir format messages.
mutt doesn't care - there's no "standard". There was a recent discussion
on mutt-users with another user moving to Maildir, who had nested
folders. He's still got nested folders, exactly as before. Just don't
name a subfolder like one of the three reserved names: "tmp", "new",
"cur".
So do it how you like it.
One aspect of MH that I have liked is that I pull mail on two machines
(using fetchmail via a POP server) and they are assigned the same filenames (numbers).
Then, if I use rsync with delete, I can delete the corresponding message in the remote
machine if I have deleted it on my local machine. It has worked like a charm over the past
15 years (I would say).
Ah. This is a little trickier with Maildir, because message flags are
stored in the filename. If you change the flags on both machines
without an rsync in between you might run into trouble. With MH the
flags are in the .mh-sequences file IIRC. You've still have an
equivalent problem though - I presume you're excluding the .mh_sequences
files from the rsync?
Is one of your machines considered the "main" machine where you read and
maintain email, and the other a backup? Or do you delete at both ends?
I use getmail via a POP server to collect my email to my laptop. I use
rsync with Maildirs in my backup process to the home server backup volume.
Thanks, I think that I am also coming round to the view that I should
stick to mutt. The listed neomutt features are:
https://neomutt.org/feature. I do not know
what is not also in mutt. But in any case, I probably won't know the difference. (I
don't completely understand all the features.)
Mainline mutt has the sidebar patch and I think the trash folder. I'm
unsure about the rest. I index my mail with notmuch, but outside of
mutt.
I want to read my e-mail locally. Basically, run fetchmail or mbsync
in the background to get mail and store in local folders at intervals, then have mutt read
them, etc. I like storing my e-mail locally so that I can get to it offline.
Same!
So I run getmail every 30s to poll my mail and pull it locally. I have
postfix configured on my laptop, so sending email is just done with
sendmail. If I'm online it goes straight out, and if not it queues until
I am online.
Cheers,
Cameron Simpson <cs(a)cskk.id.au>