Re: How to implement save_empty on maildir?
Jörg Sommer <joerg <at> alea.gnuu.de>
2009-07-02 08:10:21 GMT
Derek Martin <invalid <at> pizzashack.org> wrote:
> On Sun, Jun 28, 2009 at 07:42:53PM +0000, Jörg Sommer wrote:
>> Rocco Rutte <pdmef <at> gmx.net> wrote:
>> > * Wu, Yue wrote:
>> >> I want to let mutt deletes empty maildirs automatically, but 'save_empty' only
>> >> works for mbox, why? How to achieve it for maildir?
>> > It doesn't work for maildir. I'm not sure why, but probably because
>> > removing an empty maildir has the potential to break something as it
>> > cannot be done atomically.
>> Mutt can rename the maildir to $maildir-mutt-remove and then remove the
>> subdirectories and then the $maildir-mutt-remove. The rename can be done
> At first glance, this seems like a good solution, but actually it is
> 1. There may be an existing directory by that name already.
> Even if Mutt checks for the existence of it first, it is not safe,
> because the user could (without knowing the behavior of Mutt)
> create such a directory in between the time that Mutt checks, and
> executes the rename().
So, create the directory yourself to ensure it's there and yours.
% cat rename-test.c