Hi there !
I´m using dovecot 2.3.10 (manually compiled on Centos 8 x86_64 - fully updated), XFS filesystem, with mdbox and a separated compressed attachment directory:
mail_attachment_fs = sis compress:lz4:6:posix
mail_attachment_hash = %{sha256}
mail_attachment_dir = /ATTACHMENTS
I'm using dovecot LDA (for mail delivery). Everything works fine with the delivery and compression. The first test, I send one tar file with 7Mb. It was correctly compressed (2791959) and stored in mail_attachment_dir. But when I tried to access it via IMAP ( thunderbird/evolution) I got this message on dovecot logs:
Error: Mailbox INBOX: UID=1: read(attachments-connector(zlib(/mailboxes/domain/h1/h2/test/mdbox/storage/m.1))) failed: read(/ATTACHMENTS/19/53/19536d7b190e5ba68337625a29e7b8a6129a2dfb5935eafa424ba4da2a878532-2e9c960b7dd2985e245e0000f484007a[base64:19 b/l]) failed: Stream is smaller than expected (2791959 < 7981633) (FETCH BODY[])
The 7981633 is the original attachment size. 2791959 is the compressed size (on attachment directory). I also see 2791959 in mail message size field (instead of 7981633 that is the original size BEFORE compression) in Thunderbird.
In Evolution was not even possible to open the message. Thunderbird allow me even download the attachment, but the downloaded file is corrupted.
Looks like dovecot is showing the properties of the compressed attachment instead of the proprerties of the original attachment (before compression).
I'm also using imap_zlib and zlib plugins:
plugin {
zlib_save_level = 6 # 1..9; default is 6
zlib_save = lz4 # or bz2, xz, lz4 or zstd
}
protocol imap {
# Space separated list of plugins to load (default is global mail_plugins).
mail_plugins = $mail_plugins imap_quota imap_zlib
}
# Space separated list of plugins to load for all services. Plugins specific to
# IMAP, LDA, etc. are added to this list in their own .conf files.
mail_plugins = quota fts fts_xapian mailbox_alias zlib
This happens with every message that exceed mail_attachment_min_size (in my case, 32k) and is stored at mail_attachment_dir = /ATTACHMENTS
When I comment: mail_attachment_dir = /ATTACHMENTS, everything works fine (compression included) with imap viewing on Thunderbird/Evolution.
Please, let me know if you need further information or have any suggestions about this issue.
TIA,
Claudio