Two accounts, one maildir.

Sebastian Spaeth Sebastian at SSpaeth.de
Wed Dec 1 13:52:47 GMT 2010


On Wed, 1 Dec 2010 13:34:23 +0100, "Vek, Marvin" <laen at onedot.nl> wrote:
> According to the Maildir specification (if i understand it correctly),
> mails have unique identifiers, and multiple accounts can put the
> messages in the same ~/Maildir folder. Which is what i've tried and
> failed.
> 
> I configured the two remote repositories, and one local repository
> beeing ~/Maildir. The first run of each of the two accounts fetched
> the messages nicely, messages landing in ~/Maildir/cur/ for both
> accounts. Syncing the accounts again after that with offlineimap, it
> got confused about the messages of the other account in the directory
> structure and started to delete messages on both accounts. I'm
> guessing this isn't supported?

Replying to this one as it is related to my previous mail about warning
users if this is not supported. Can we find out if this is really not
supposed to work?

It is a good question. Let us assume you have 2 accounts for:
 A1: Imap1 <-> Maildir1
 A2: Imap2 <-> Maildir1

Assume there is one mail on each IMAP account:
M1 on IMAP1 has UID1
M2 on IMAP2 has UID2

Lets sync:

+-------+---------+-------+----------------+----------------+
| IMAP1 | Maildir | IMAP2 | LocalStatus A1 | LocalStatus A2 |
+-------+---------+-------+----------------+----------------+
| UID1  |         | UID2  |                |                |1
+-------+---------+-------+----------------+----------------+
| UID1  |  UID1   | UID2  | UID1           |                |2
+-------+---------+-------+----------------+----------------+
| UID1  |  UID1   | UID2  | UID1           | UID2           |3
|       |  UID2   |       |                |                | 
+-------+---------+-------+----------------+----------------+
Step 1: Initial situation
Step 2: Sync A1: M1 with UID1 gets transferred to Maildir 
Step 3: Sync A2: M2 with UID2 gets transferred to Maildir

So far so good, now let's sync again.

+-------+---------+-------+----------------+----------------+
| IMAP1 | Maildir | IMAP2 | LocalStatus A1 | LocalStatus A2 |
+-------+---------+-------+----------------+----------------+
| UID1  |  UID1   | UID2  | UID1           | UID2           |4
| UID2' |  UID2'  |       | UID2'          |                |
+-------+---------+-------+----------------+----------------+
| UID1  |  UID1'  | UID1' | UID1           | UID1'          |5
| UID2' |  UID2'' | UID2''| UID2'          | UID2''         |
+-------+---------+-------+----------------+----------------+

Steps 4: Sync A1 again:
      New Mail M2 in Maildir detected and uploaded to IMAP1, gets new
      UID2' by mail server which is recorded in LocalStatus A1, and we
      modfy the mail in Maildir to also have UID2' (as it was assigned a
      new one).
Steps 5: Sync A2 again:
      Syncing Maildir to IMAP2, we find new local mails UID1 and UID2',
      while UID2 has been deleted. So delete UID2 on IMAP2 and upload
      UID1 and UID2' to IMAP. Both will be assigned a new UID by IMAP2
      which will be recorded locally.

Rinse and repeat.... :-).

Not sure if my analysis is actually correct, but I am willing to be
corrected. Not sure if there is a way to deal better with this
situation, or if we want to support that. As I said the current parallel
account synchronization would lead to unpredictable results anyway.

Hope that helps. We should have a flowchart of that synching algorithm,
wrapping my head around it based on code was quite tough.

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20101201/8054bf99/attachment-0001.sig>


More information about the OfflineIMAP-project mailing list