[Dovecot] Bug in zlib Plugin (2.0)
Hello everyone.....
I Made some tests in zlib plugin, and in ostream file (ostream-zlib.c) in o_stream_zlib_sendv function, have it:
stream->ostream.offset += bytes;
In struct mail_save_context, have saved_physical_size and it can be updated, acording with the observation.
/* if non-zero, overrides the physical size that should be saved.
for example when using zlib plugin, this would contain the mail's
uncompressed size. */
uoff_t saved_physical_size;
in file zlib-plugin.c in zlib_mail_save_compress_finish function, have it:
ctx->saved_physical_size = ctx->output->offset;
It's a update to offset (the size of email) in zlib, but if you update this value with a new number, the W flag in email is NOT updated.
This is the original file, without update the or increase offset. 1273155226.M512158P16310.brc,S=435,W=390:2,S
This is the file updated with 5000b more.
1273155226.M512158P16310.brc,S=5435,W=390:2,S
The S is updated, but W not.
OK, this not matter in zlib plugin, because the physical size is the email uncompressed, but if you use the zlib as example, and you use this value (saved_physical_size) to update your saved email size, it can't update the W flag, and the email will not be open, because the W size is wrong.
On Thu, 2010-05-06 at 11:35 -0300, Alex Baule wrote:
/* if non-zero, overrides the physical size that should be saved. for example when using zlib plugin, this would contain the mail's uncompressed size. */
uoff_t saved_physical_size;
Looks like the comment is a bit bad. Its only purpose is to tell dbox code to save physical-size metadata field with the given size. Maildir doesn't do anything with it. Maybe I can find a way to remove the whole variable entirely, since dbox code should already be able to figure out all that internally..
On Wed, 2010-05-26 at 15:52 +0100, Timo Sirainen wrote:
On Thu, 2010-05-06 at 11:35 -0300, Alex Baule wrote:
/* if non-zero, overrides the physical size that should be saved. for example when using zlib plugin, this would contain the mail's uncompressed size. */
uoff_t saved_physical_size;
Looks like the comment is a bit bad. Its only purpose is to tell dbox code to save physical-size metadata field with the given size. Maildir doesn't do anything with it. Maybe I can find a way to remove the whole variable entirely, since dbox code should already be able to figure out all that internally..
Yeah, removed: http://hg.dovecot.org/dovecot-2.0/rev/e84e72fb1af9 http://hg.dovecot.org/dovecot-2.0/rev/4eaebea097db
participants (2)
-
Alex Baule
-
Timo Sirainen