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 667576 - Junk between messages after saving an mbox file
Junk between messages after saving an mbox file
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
3.2.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
: 671527 679037 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-01-09 15:50 UTC by James Bottomley
Modified: 2012-06-28 13:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
an example of saving four emails from the linux-scsi mailing list. Note the huge amount of binary junk between emails 2,3 and 3,4 (145.80 KB, application/octet-stream)
2012-01-09 15:50 UTC, James Bottomley
  Details
Recommended fix which gets a new buffer each time (1.57 KB, patch)
2012-01-09 21:55 UTC, James Bottomley
reviewed Details | Review

Description James Bottomley 2012-01-09 15:50:03 UTC
Created attachment 204878 [details]
an example of saving four emails from the linux-scsi mailing list.  Note the huge amount of binary junk between emails 2,3 and 3,4

openSUSE 12.1; evolution-3.2.1-2.2.2.i586

Selecting three or more emails to save and doing save as results in the emails having a huge amount of junk characters separating them.  This is a fairly recent regression because saving multiple emails worked in 2.x

I've added an attachment from saving four emails from linux-scsi by way of example
Comment 1 James Bottomley 2012-01-09 21:55:04 UTC
Created attachment 204909 [details] [review]
Recommended fix which gets a new buffer each time
Comment 2 James Bottomley 2012-01-09 21:55:35 UTC
The change that seems to have caused this is

commit f0a011f941bab3f6ac7228be4e1bec86a0de0d2a
Author: Matthew Barnes <mbarnes@redhat.com>
Date:   Tue May 17 19:50:33 2011 -0400


I the problem seems to be that the new use of g_seekable_seek() to rewind the memory buffer backed stream in e_mail_folder_save_messages_sync() doesn't reset the byte_array->len parameter properly, so we're carrying junk characters for subsequent goes around the loop.

I tried adding complete truncates in there as well, but nothing works.  The only fix is to get a new byte_array and basic_stream for each go around the loop.  I'd say the true bug probably lies in g_seekable_seek(), but we need a fix for evolution now, so I'm requesting this patch be applied
Comment 3 André Klapper 2012-02-02 11:54:28 UTC
CC'ing Matt as the initial commit triggering this was by him.
Comment 4 Matthew Barnes 2012-02-02 13:12:47 UTC
(In reply to comment #2)
> I the problem seems to be that the new use of g_seekable_seek() to rewind the
> memory buffer backed stream in e_mail_folder_save_messages_sync() doesn't reset
> the byte_array->len parameter properly, so we're carrying junk characters for
> subsequent goes around the loop.

Actually g_seekable_seek() is working correctly, it's just the wrong thing to do here.  I'm sure that's my bad.

James has the right idea in creating a new stream each time, but if we use camel_stream_mem_set_byte_array() after creating the stream instead of camel_stream_mem_new_with_byte_array(), then the stream won't take ownership of the GByteArray and we can reuse it for each message (it's one of Camel's little quirks).
Comment 5 Matthew Barnes 2012-02-02 14:21:50 UTC
Fixed for Evolution 3.3.5 in:
http://git.gnome.org/browse/evolution/commit/?id=df3495a6ec99d53beeaac6b9a2fde8dfd356c439

With credit to James for the solutions; I just tweaked it a bit.
Comment 6 Milan Crha 2012-04-23 07:24:03 UTC
*** Bug 671527 has been marked as a duplicate of this bug. ***
Comment 7 DT 2012-04-26 00:28:33 UTC
Any chance of backporting this critical fix to 3.2.3?  Unable to resolve the extensive dependencies to move to 3.3.5.  Don't have GNOME 2 so unable to resolve dependencies for lower versions.  This is a serious bug.  Evolution hangs and demands >100gb disk space.  Would be great if I could export my email sometime before the next production release of my distro.
Comment 8 André Klapper 2012-04-26 08:59:14 UTC
DT: Feel free to ask your distribution to provide a package with the patch for you.  No 3.2.4 upstream release planned, sorry.
Comment 9 Matthew Barnes 2012-06-28 13:01:28 UTC
*** Bug 679037 has been marked as a duplicate of this bug. ***