After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 618514 - Forwarded messages as attachments encoded incorrectly
Forwarded messages as attachments encoded incorrectly
Status: RESOLVED FIXED
Product: evolution-mapi
Classification: Applications
Component: Mail
0.30.x
Other Linux
: Normal normal
: ---
Assigned To: evolution-mapi-maint
evolution-mapi-maint
: 632900 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-05-13 08:12 UTC by Milan Crha
Modified: 2011-03-15 09:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed ema patch (978 bytes, patch)
2011-03-07 17:31 UTC, Milan Crha
committed Details | Review
Same patch as above, but for gnome-2-32 (62.18 KB, patch)
2011-03-08 15:06 UTC, sean finney
reviewed Details | Review

Description Milan Crha 2010-05-13 08:12:20 UTC
Forwarding from a downstream bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=591734

when forwarding a message from evolution, using the mapi connector, the message
is forwarded as an eml file that is unrecognizable by most mail clients.

When forwarding a simple plain-text message to myself at Gmail, Yahoo!, and
another IMAP account, I only received a blank email with an attachment:
ATT60520..eml.  Gmail, Yahoo!, and SeaMonkey 2 (same code base as TB3), didn't
know what to do with this message.
Comment 1 Milan Crha 2010-11-02 12:13:55 UTC
*** Bug 632900 has been marked as a duplicate of this bug. ***
Comment 2 sean finney 2011-03-07 15:42:08 UTC
Hi,

I can still see this problem, and looking more closely, it seems that the forwarded message attachment contains the text, plus one extra null byte.  Here's a copy of the attachment that I right-click-saved from OWA:

Thread-Topic: orig subj
Thread-Index: Acvc2IYRa2EdVrAZTjaVes/6bDzIcQ==
Accept-Language: en-US, sv-SE
X-MS-Has-Attach: 
X-MS-Exchange-Organization-SCL: -1
X-MS-TNEF-Correlator:
 <F8E420FCC4E2DB4FA107EB2FE156BD7E86F16F@somehost>
MIME-Version: 1.0
Content-class: urn:content-classes:message
Subject: orig subj
Reply-To: "Finney, Sean" <Sean.Finney@somedomain>
From: "Finney, Sean" <Sean.Finney@somedomain>
Message-ID: <F8E420FCC4E2DB4FA107EB2FE156BD7E86F16F@somehost>
Content-Type: multipart/mixed; boundary="=-RBDTtRvROjM6gtxxX5fe"


--=-RBDTtRvROjM6gtxxX5fe
Content-Transfer-Encoding: 8bit
Content-Type: text/plain

orig body
^@
--=-RBDTtRvROjM6gtxxX5fe--

where "^@" is less highlighting a null byte.

Off by one error somewhere, maybe?
Comment 3 sean finney 2011-03-07 16:22:01 UTC
From another test message, i set a bp on camel_mime_part_set_content, and can see that indeed the length seems to be the strlen +1 for the message contents.

Interestingly, this seems to be the case for not just the attachment but also for the message body too!  Here is the first of two backtraces, with the message body from the main message (the one containing the forwarded message as an attachment):

  • #0 camel_mime_part_set_content
  • #1 mapi_mime_classify_attachments
    at exchange-mapi-mail-utils.c line 828
  • #2 mapi_mail_item_to_mime_message
    at exchange-mapi-mail-utils.c line 871
  • #3 mapi_folder_get_message
    at camel-mapi-folder.c line 1252
  • #4 camel_folder_get_message
    at camel-folder.c line 1752
  • #5 get_message_cb
    at camel-filter-driver.c line 1449
  • #6 camel_filter_search_get_message
    at camel-filter-search.c line 132
  • #7 junk_test
    at camel-filter-search.c line 674
  • #8 e_sexp_term_eval
    at e-sexp.c line 731
  • #9 e_sexp_eval
    at e-sexp.c line 1545
  • #10 camel_filter_search_match
  • #11 camel_filter_driver_filter_message
    at camel-filter-driver.c line 1548
  • #12 filter_filter
    at camel-folder.c line 202
  • #13 session_thread_proxy
    at camel-session.c line 321
  • #14 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #15 g_thread_create_proxy
    at gthread.c line 1897
  • #16 start_thread
    at pthread_create.c line 300
  • #17 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 112
  • #18 ??
  • #0 camel_mime_part_set_content
    at camel-mime-part.c line 1306
  • #1 mapi_mime_msg_body
    at exchange-mapi-mail-utils.c line 506
  • #2 mapi_mail_item_to_mime_message
    at exchange-mapi-mail-utils.c line 889
  • #3 mapi_folder_get_message
    at camel-mapi-folder.c line 1252
  • #4 camel_folder_get_message
    at camel-folder.c line 1752
  • #5 get_message_cb
    at camel-filter-driver.c line 1449
  • #6 camel_filter_search_get_message
    at camel-filter-search.c line 132
  • #7 junk_test
    at camel-filter-search.c line 674
  • #8 e_sexp_term_eval
    at e-sexp.c line 731
  • #9 e_sexp_eval
    at e-sexp.c line 1545
  • #10 camel_filter_search_match
  • #11 camel_filter_driver_filter_message
    at camel-filter-driver.c line 1548
  • #12 filter_filter
    at camel-folder.c line 202
  • #13 session_thread_proxy
    at camel-session.c line 321
  • #14 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #15 g_thread_create_proxy
    at gthread.c line 1897
  • #16 start_thread
    at pthread_create.c line 300

Comment 4 sean finney 2011-03-07 16:23:12 UTC
okay bugzilla seems to think that's one backtrace, but there's two in there.  sorry for the mess.
Comment 5 Milan Crha 2011-03-07 17:27:46 UTC
(In reply to comment #2)
> where "^@" is less highlighting a null byte.
> 
> Off by one error somewhere, maybe?

It's not off by one, it's because evolution-mapi is adding this \0 intentionally, because some parts, like calendar part, expects null-terminated string. The other part, like mailer, doesn't expect/need this extra \0, but it doesn't remove it.
Comment 6 Milan Crha 2011-03-07 17:31:02 UTC
Created attachment 182730 [details] [review]
proposed ema patch

for evolution-mapi;

Could you try with this patch, whether it'll fix both issues, please?

This is fixing extra \0 for newly downloaded messages (for old messages is used local cache, so remove ~/.local/share/evolution/mail/mapi/<account>/folders/* and refetch your messages) and then try if also forwarding will work as expected on both sides, the other client and evolution client, maybe owa too, or not.

Thanks in advance.
Comment 7 Milan Crha 2011-03-08 07:15:17 UTC
OK, the above patch is fixing only the extra \0, but I recalled what's the fix for this - the attached message cannot be stored as raw data, but as an image object in the attachment, thus it requires a bit more work to make it behave as we want. I'm looking on this today.
Comment 8 Milan Crha 2011-03-08 07:18:44 UTC
Created commit 1172bf3 in ema master (2.91.92+) for the unrelated patch
Comment 9 sean finney 2011-03-08 08:19:53 UTC
just to confirm: yes, that does seem to fix the extra null byte, and yes, you're correct that it's not the underlying cause the forwarding problem--so a bugfix nonetheless, but not the bug that was reported :)

Let me know if you need me to test anything else!
Comment 10 Milan Crha 2011-03-08 13:52:39 UTC
OK, I got it finally. The patch is lightly larger, but only because of reorganizing the code, moving relevant parts from camel to libexchangemapi. It works nicely for me, but please let me know if anything doesn't work for you. Thanks in advance. (I also tried attaching a message which has as attachments other messages, one with real attachments, and the OWA together with evo shows them properly.)

Created commit 918f7d4 in ema master (2.91.92+)
Comment 11 sean finney 2011-03-08 15:06:56 UTC
Created attachment 182831 [details] [review]
Same patch as above, but for gnome-2-32

As no further changes are going into the gnome-2-32 branch, and as many people need to still support gnome-2-32 for a while, here's the same patch on top of the .32 version, for those who were fortunate enough to dig their way to this BR :)
Comment 12 sean finney 2011-03-08 15:08:15 UTC
Review of attachment 182831 [details] [review]:

.
Comment 13 Akhil Laddha 2011-03-09 04:14:58 UTC
If patch is safe, we should commit patch in branch 2-32. It's always easy to pick patch from git sources instead of searching for the bug id.
Comment 14 Milan Crha 2011-03-09 07:20:58 UTC
(In reply to comment #13)
> If patch is safe, we should commit patch in branch 2-32. It's always easy to
> pick patch from git sources instead of searching for the bug id.

I'm against this approach personally, because if we are not going to do a release on gnome-2-32 branch, then the commit is just waste of time and disk space in git.
Comment 15 David Woodhouse 2011-03-12 18:18:55 UTC
(In reply to comment #14)
> I'm against this approach personally, because if we are not going to do a
> release on gnome-2-32 branch, then the commit is just waste of time and disk
> space in git.

I disagree. Even if *we* don't do a new release, having the commits right there in the gnome-2-32 branch means that every distributor can cherry-pick them if they see fit. And we do have the *option* of doing a new 2.32.x release if we want to.

(Please could we try not to mingle code reorganisation and bug fixes in the same patch, btw? I'm looking at your commit in evo-mapi, since we're going to need to do something similar in evo-ews, and I can't actually see what you changed, amongst the code reorg. When moving code, best practice is to *just* move it in one commit, and if you want to make changes to it, do that in a separate commit.)
Comment 16 Milan Crha 2011-03-14 07:32:46 UTC
(In reply to comment #15)
> I disagree. Even if *we* don't do a new release, having the commits right there
> in the gnome-2-32 branch means that every distributor can cherry-pick them if
> they see fit. And we do have the *option* of doing a new 2.32.x release if we
> want to.

Well, your opinion, my opinion. Nothing relevant to this bug. Anyway, please do not commit on your own to modules which you do not maintain unless you've an approval. Do you remember the fiasco with nss being committed to stable version?

> (Please could we try not to mingle code reorganisation and bug fixes in the
> same patch, btw? ...)

Maybe we can, but I cannot. The code move was indivisible part of the fix. In other words, taking only the change, and not the move of the code will not fix the bug, but break build.
Comment 17 David Woodhouse 2011-03-14 09:41:53 UTC
Normally I would expect to see code moved without changing it, and then the bug fix in a second commit. Was that not possible in this case?
Comment 18 sean finney 2011-03-15 09:48:50 UTC
Within the "reorg" part of the commit (i.e. the large blocks of moved code), iirc the significant part of the change was the block starting with CAMEL_IS_MIME_MESSAGE.  I don't recall there being more.  

The changes for the .32 version of the patch were basically to cope with the camel API changes in 2.9x, (the GCancellable stuff and some seeking related stuff).

And PS: while I've already made my opinion about the lack of any stable+maintained version of evolution to others via IRC, I also agree that it's mostly tangential to this bug.  

However, I have been keeping a patch queue of ~12-15 other fixes in our locally maintained .32 tree.  So if you do change your mind, or have somewhere less official to place it, just let me know and I'm happy to share.