Hi,
Moving mail files between Maildir mailboxes often confuses doveadm sync: I end up with copies in both the original and new maildir. Exact details and script to reproduce follow.
I can work around this by running doveadm move, but it does not fit well with my workflow, which is based on paths to mail files (using mblaze as my mail client).
Two questions:
Is there anything I can do to help dovecot notice the moves, other than using doveadm move instead of just mv? I have tried liberal use of force-resync but the problem is still there.
Is this a bug?
Details:
OS: OpenBSD current
$ dovecot --version 2.3.21.1 (d492236fa0)
config: My repro script below uses a one-line config, only setting mail_location.
(An OpenBSD 7.5 server running Dovecot 2.3.21 is involved in my real setup, but I was able to reproduce it locally without the server involved.)
To reproduce: (shell script follows)
- Make two maildirs "a" and "b", each with a subfolder ".Archive".
- Manually write a mail file to a/cur.
- doveadm sync
- force-resync everything
- manually move the file to a/.Archive/cur
- force-resync everything again
- doveadm sync
- Now the mail file appears four times: in a, a/.Archive, b, and b/.Archive.
Script to do the above follows my signature.
-- James
#!/bin/sh set -e
# Run in a new directory with two maildirs named a and b and a simple config.
mkdir bug; cd bug
mkdir -p {a,b}/{,.Archive/}{cur,new,tmp}
cat > dovecot.conf < # Deliver an email and sync.
EXAMPLE_ID=12345.R67890.example.com
cat > a/cur/$EXAMPLE_ID:2, < # Move the email and sync again. Run force-resync between steps in case it helps.
doveadm -c dovecot.conf force-resync INBOX
doveadm -c dovecot.conf force-resync Archive
doveadm -c dovecot.conf -o mail_location=maildir:$PWD/b force-resync INBOX
doveadm -c dovecot.conf -o mail_location=maildir:$PWD/b force-resync Archive
mv a/cur/$EXAMPLE_ID* a/.Archive/cur
doveadm -c dovecot.conf force-resync INBOX
doveadm -c dovecot.conf force-resync Archive
doveadm -c dovecot.conf -o mail_location=maildir:$PWD/b force-resync INBOX
doveadm -c dovecot.conf -o mail_location=maildir:$PWD/b force-resync Archive
doveadm -c dovecot.conf sync maildir:b echo in a:
doveadm -c dovecot.conf -fflow fetch 'mailbox guid' all
echo
echo in b:
doveadm -c dovecot.conf -fflow -o mail_location=maildir:$PWD/b fetch 'mailbox guid' all