Some attachments in Piler are corrupted

Issue #1042 resolved
Christian created an issue

Piler has been running for a while now and done a great service, so far.

But recently I discovered that occasionally (like 60 % of) the attachments are corrupted.
Meaning sometimes after downloading they have a 0 Byte file size and sometimes the file is corrupted and can’t be opened.

One of my questions is, if I would do a pilerimport and import all the mails i still have in my IMAP would this overwrite the corrupted attachments? Or would Piler just leave the corrupted attachments there because they already exist?

Comments (14)

  1. Janos SUTO repo owner

    Piler wouldn’t overwrite existing emails archived. You need some debugging to figure out what’s wrong. Select a message on the gui that has a corrupted attachment. Then try downloading the message as an eml file. Then open it with some text editor, and check the attachments in the eml file. Also be sure to check the mail log if it syslogs any issue when you download the message.

  2. Christian reporter

    Thank you for your answer.

    I just did what you proposed and when I download the .eml file and extract the attachment it suddenly has 23 KB compared to 0 B when downloaded directly. But the file is still corrupted (even with 23 KB more) and cannot be opened. No messages in mail.log.

  3. Janos SUTO repo owner

    Indeed, the attachment part looks odd. What version of piler do you have? Run piler -V

  4. Christian reporter

    piler 1.3.1-epoll, build 980, Janos SUTO sj@acts.hu

    Build Date: Sat Oct 7 16:20:27 CEST 2017
    ldd version: ldd (Debian GLIBC 2.24-11+deb9u1) 2.24
    gcc version: gcc version 6.3.0 20170516 (Debian 6.3.0-18)
    OS: Linux tascam 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u5 (2017-09-19) x86_64 GNU/Linux
    Configure command: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-database=mariadb
    MySQL client library version: 5.5.1
    Extractors: /usr/bin/pdftotext /usr/bin/catdoc /usr/bin/catppt /usr/bin/xls2csv /usr/bin/unrtf /usr/bin/tnef

  5. Janos SUTO repo owner

    It’s possible that a bug caused improper writing of attachments in some cases. I’d like you to get the master branch (see the download section in bitbucket), and upgrade piler.

  6. Christian reporter

    I’m already in the progress to upgrade to a containerized (docker) Piler (i use https://bitbucket.org/jsuto/piler/downloads/piler-1.3.7.tar.gz; i assume that is the master branch).
    Is there any way to fix the corrupted attachments? For example i could take the fresh install of piler 1.3.7, then run pilerimport on the imap server and then … i don’t know how, use pilerimport to import from the old piler.
    If it is as you say that pilerimport won’t overwrite existing e-mails or attachments… that’s how i could ensure as many as possible intact attachments to be in Piler.

    I also seems to me that older messages (before 2017) are not as affected by this problem as recent (2 or 3 years old) ones.

    Thanks for your help.

  7. Janos SUTO repo owner

    Yes, 1.3.7 should be fine. Unfortunately there;s no way fixing already archived emails. If you have all your emails still on the mail server, then I suggest to start a new archive, import them all, then discard the legacy archive.

  8. Christian reporter

    What if i wrote some script to download all e-mails from the old piler as .eml file into a folder.
    Then run pilerimport on the IMAP server on the new piler (1.3.7)
    and then run “pilerimport -d”, it would not overwrite existing (intact) e-mails, just add old ones that are no longer stored in the IMAP.

    What do you think? Could that work?

  9. Log in to comment