deltachat / chatmail

chatmail service deployment scripts and docs
https://delta.chat/en/2023-12-13-chatmail
MIT License
97 stars 5 forks source link

dovecot: LMTP hardlinking is not working #339

Closed link2xt closed 2 days ago

link2xt commented 3 days ago

LMTP is supposed to deliver message once for the first recipient, then hardlink or copy the message to other recipients. As in typical chatmail setup all mailboxes reside on the same filesystem and owned by the same user and group, delivered mails should be hardlinked. However, it is not the case, stat command shows "Links: 1" for all delivered mails.

Apparently it is the problem caused by Sieve which is used for message notifications: https://dovecot.dovecot.narkive.com/qfq7puPs/maildir-hardlinks-with-sieve

hpk42 commented 3 days ago

Thanks for investigating. The linked issue seems to indicate that it's not going to be fixed. What is this issue about then?

link2xt commented 3 days ago

What is this issue about then?

We can try to get rid of Sieve filter or fix this by hardlinking manually afterwards, e.g. by running rdfind over maildirs. rdfind does not seem to hardlink atomically though, i.e. may accidentally restore file if dovecot deletes it at the same time we try to hardlink it.

hpk42 commented 3 days ago

I don't think restoring a file would be a big issue .... It would get removed after twenty days anyways. And it's only a hard link so not really taking up real disc space.

link2xt commented 3 days ago

I don't think restoring a file would be a big issue .... It would get removed after twenty days anyways. And it's only a hard link so not really taking up real disc space.

Restoring disappearing messages that are supposed to be deleted in less than 20 days is not that nice if it happens frequently.

missytake commented 2 days ago

Getting rid of sieve doesn't sound like a problem - we don't use it anyway, right?

link2xt commented 2 days ago

Getting rid of sieve doesn't sound like a problem - we don't use it anyway, right?

We use sieve to flag Auto-Submitted messages with $Auto flag: https://github.com/deltachat/chatmail/blob/b1d11d7747c0d82bd78d3b632a734988ec33072c/cmdeploy/src/cmdeploy/dovecot/default.sieve

Then we notify about new messages if the message does not have $Auto flag: https://github.com/deltachat/chatmail/blob/b1d11d7747c0d82bd78d3b632a734988ec33072c/cmdeploy/src/cmdeploy/dovecot/push_notification.lua

This is to prevent sending notifications for MDNs and similar messages.

But I will try to get rid of this sieve script.