[notmuch] Potential problem using Git for mail (was: Idea for storing tags)
Asheesh Laroia
asheesh at asheesh.org
Thu Jan 14 00:12:24 PST 2010
On Tue, 12 Jan 2010, martin f krafft wrote:
> If the MDA delivers to Git, then potentially, you might get into a
> situation where you cannot write your own changes back to the repo. This
> is also a DoS scenario: I'll just keep sending you e-mail, and if I
> manage to pass your mail filters, I'll basically commit to your mail
> repository at regular intervals. Say those are 5 seconds. In order for
> you to write updates to the repo, e.g. to update tags, then you would
> need to pull, rebase, and push all within 5 seconds, for otherwise you'd
> try to push non-fast-forwards.
Sure. But the MDA doesn't need to do the commit immediately. Since
(presumably) we're using Maildir, the MDA on the mail receiving server is
going to generate filenames that won't cause conflicts. So it's okay to
leave the files uncommitted.
If that's too scary, then have the MDA deliver to its own git branch with
its own checkout. Then, if you can force linearity with a lock (!), your
client can have a special "lock the repo and push" command. Your remote
MUA could even ask the MDA to lock the Maildir while it does a merge and
then pushes that, and then the MDA can go back to dequeuing messages from
the MTA into the Maildir.
Not the beautiful lockless world the purists want, but I'm okay with that.
> This a bit unrealistic, surely, but there's a real annoyance in it:
> you'd have to pull/rebase/push until a push succeeds — until you found a
> time window between pull and push during which the MDA didn't write to
> the repo. This might take a long time. If this happens in the background
> by Cron, it's not a real concern, but if this becomes a UI issue, I
> wouldn't know how to handle it.
It's not entirely unreasonable. Cron caused issues like that for me when I
tracked my Maildir in git.
I'm just learning about notmuchmail.org, but I'll keep listening here.
Preferably CC: me on replies to this mail.
I will say, I'm interested in an email setup with with working IMAP on at
least one side.
There's one other bad race I ran into when using git to manage my
Maildirs. I was using Dovecot to serve my Maildir to an IMAP client,
alpine. I separately did a "git merge" from origin/master, where the
remote MTA had an MDA deliving messages and a layer on top of that
committed them.
When I did the "git merge", git would create the Maildir files in
~/Maildir/cur/... non-atomically. Dovecot would notice the file in
~/Maildir/cur/ and think, "This file must be ready!" So it would parse it
even though git hadn't finished writing it. This caused me to only see
partial headers in Alpine since Dovecot parsed it before it was a complete
message.
That kind of sucked.
-- Asheesh.
--
Almost anything derogatory you could say about today's software design
would be accurate.
-- K. E. Iverson
More information about the notmuch
mailing list