<div dir="ltr">Hi Thomas,<div><br></div><div>Thanks for sharing it !<br><br><div class="gmail_quote">Em sex, 20 de mar de 2015 às 10:16, Thomas Jarosch &lt;<a href="mailto:thomas.jarosch@intra2net.com">thomas.jarosch@intra2net.com</a>&gt; escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
we are doing backups of our imap mailboxes using<br>
simple unix tools like find + afio. Sometimes, when a mailbox<br>
is still locked, deleted files were not expunged immediately<br>
and therefore ended up in the backup.<br>
<br>
During testing we found an additional problem with re-creating<br>
a deleted folder and fixed this one in the same run, too.<br>
<br>
Attached you&#39;ll find a few tools for cyrus imapd 2.4(.17):<br>
<br>
1. cyr_getdeleted: Lists deleted IMAP messages for a given mboxspec.<br>
    (+ additional patch to add it to the build system)<br>
<br>
2. A patch for cyrus to create a &quot;.deleted&quot; file when a folder<br>
  is marked for deletion. If the folder is re-created before it<br>
  was removed from disk and we find the .deleted file,<br>
  we clear out all *stale* messages.<br>
<br>
3. find_wrapper.py: A wrapper around find(1) to automatically<br>
  exclude deleted messages and folders. Useful for backup shell scripts.<br>
  Makes use of the &quot;.deleted&quot; file, too.<br>
<br>
I&#39;m putting this out here in case these additions might come in handy<br>
for other people running cyrus imapd 2.4. Most of those tools and patches<br>
were developed by my colleague Samir Aguiar.<br>
<br>
As written in the &quot;Mailbox deletion race: folders and files are never deleted&quot;<br>
email[1] , we&#39;ll especially revisit issue 2. when testing cyrus 2.5.x<br>
<br>
Have a nice day,<br>
Thomas<br>
<br>
[1] <a href="http://lists.andrew.cmu.edu/pipermail/cyrus-devel/2015-February/003133.html" target="_blank">http://lists.andrew.cmu.edu/<u></u>pipermail/cyrus-devel/2015-<u></u>February/003133.html</a><br>
</blockquote></div></div></div>