[PATCH] Re: introducing xattrMaildir: a Maildir repository where message files have all IMAP flags in an extended attribute

Erik Quaeghebeur offlineimap at equaeghe.nospammail.net
Tue Mar 12 09:44:52 GMT 2013

Dear Cyril,

First of all, I must stress that this patch cannot work without my 
earlier one “Let OfflineIMAP sync all flags between IMAP servers, not 
just Maildir-compatible flags”, which is far more invasive, but—I 
think—also useful to a much wider audience; formulated differently: I 
think it corrects a historically understandable but wrong design choice 
and is the more important of the two, needing close scrutiny.

> Can you provide me a way to test it (what fs should I use, options and so
> on) ?

Well, any filesystem supporting extended attributes supported by the 
xattr module (http://pyxattr.k1024.org/, cf. also 
https://en.wikipedia.org/wiki/Extended_file_attributes), which should be 
most Linux and the Mac OS X filesystems. I use ext4. For Linux, xattr 
suppurt should be compiled with/in the kernel (this is standard for most 
distributions). It may also be necessary to mount with the user_xattr 
option (cf., e.g., 

Then I created a test folder on one server and use OfflineIMAP to sync 
that folder only to a local xattrMaildir store. Add messages to this 
folder on the IMAP server and add/remove (custom) IMAP flags and see how 
they (do not) sync (before) after adding the patch. To 'see' the custom 
flags, use the getfattr command on linux (there is a corresponding tool 
on OS X, I think called xattr). To test syncing back from the 
xattrMaildir (i did not do this yet, but the patch is meant to support 
that as well), you can use the setfattr command (on linux, Mac OS X its 
counterpart) to change extended attributes.

> How different is the new xattrMaildir file to the existing one ? Would it
> be possible to derive from the initial class and change the method that
> needs to be changed ?

I derive xattrMaildir (both the folder and repository) from their 
Maildir counterparts. It removes absolutely no functionality from them, 
it only adds the extended attribute with all IMAP flags.

> What's the purpose of this, compared to the version with the modified
> filenames ?

What version are you referring to?

> Would it work with an external tool (or the synced flags will be ignored ?)

Any Maildir-capable tool will not be impacted when using xattrMaildir 
instead of Maildir. Only modified tools will be able to make use of the 
extra functionality provided by the extended attribute.

Thanks for looking at this,


P.S.: I am more and more convinced that a modification of the Maildir 
store activated using an option would be a better option, as the code 
changes of xattrMaildir over standard Maildir are very slight. When I 
have time, I'll prepare a patch that does this, it should be more 
readable than this one.

More information about the OfflineIMAP-project mailing list