[Dovecot] 2.1: Error: Maildir filename has wrong S value, renamed the file from

Patrick Domack patrickdk at patrickdk.com
Wed Mar 21 23:52:39 EET 2012

Quoting Timo Sirainen <tss at iki.fi>:

> On 21.3.2012, at 17.52, Ralf Hildebrandt wrote:
>> * Timo Sirainen <tss at iki.fi>:
>>>> It's renaming itself to itself again?
>>> Hmm. Yeah, this is a bit problematic for compressed mails. If the
>>> S=size isn't correct, Dovecot fixes it by stat()ing the file and using
>>> it as the size. And that's of course wrong. Also Dovecot can't simply
>>> remove the S=size, because the current Maildir code assumes that it
>>> always exists for compressed mails. There's no easy and efficient way
>>> to fix this.. Maybe you could just manually rename the files to have
>>> correct S=size? :) zcat file | wc should give the right size.
>> Right now the whole system is down because nobody can acces his/her
>> mails due to this.
> All of your mails are compressed and have wrong S=size in the  
> filename? You can disable the check with the attached patch, but I'm  
> not sure if there are other places where it fails. At least quota  
> calculations won't be correct.

The issue only started happening since I upgraded to 2.1.1, it didn't  
exist before then, I have check my system, and files before the date  
of upgrade are fine, only files/emails moved after upgrading to 2.1.1  
have lost the S= value.

I have made something that can pretty easily fix the issue, but it  
only stays fixed till another email gets moved and looses it's S= value.

Sorry, I haven't had time to test out 2.1.3 yet.

This will print out the commands needed to fix the files though.

find . -name '*hostname:*' -exec 'gzip' '-l' '{}' ';' | awk  
'/hostname/ {for(x=4;x<NF;x++) { fn=$x " "; } fn=fn $x;  
split(fn,a,":"); print "mv \"" fn "\" \"" a[1] ",S=" $2 ":" a[2] "\"";}'

Just change hostname to dovecot is using in your files.

More information about the dovecot mailing list