Re: [evolution-patches] fix for bug #63377



On Thu, 2004-08-26 at 11:57 +0800, Not Zed wrote:
> 
> No this is wrong.  Try looking closer, the charset is set by em-
> folder-view which monitors changes to the value.  You shouldn't re-
> read it here, it should only be set by invoking set_default_charset().

ah, right you are...

> 
> The idea is any quoting or replying should be passed a 'source'
> formatter, so it can get the layout info, charset the user is using,
> etc.  But that isn't always avaible.  The charset should be set on the
> formatter when its created from the current value.  em-folder-view
> should just cache that value, and use that.

right, I saw that but missed where emfv init'd the formatter's default
charset. grepped again and it was there like you said :)

was looking thru that code again today and I'm thinking the easiest way
to fix this would probably be to have em_utils_message_to_html() check
the charset setting in gconf if source==NULL?

is that your thinking as well? or is that not the nicest way of doing
it?

> 
> (there is a practical reason to do this, and it makes em-format a more
> re-usable object by not tying it to the gconf value directly).

yep, understood.

Jeff

> 
> On Wed, 2004-08-25 at 16:59 -0400, Jeffrey Stedfast wrote: 
> > that pesky g_assert (*inptr == '@'); crash again...
> > 
> > surprisingly nothing in the mailer code actually used
> > the /apps/evolution/mail/display/charset setting until now...
> > 
> > this forces UTF-8 conversion which of course truncates out bad character
> > sequences which then means that e_trie_search() gets sane input
> > 
> > not sure if we want to bother making e_trie_search() more robust against
> > garbage non-UTF-8 input, but I had started to look at fixing it that way
> > originally until I realised that the mailer was simply not doing any
> > charset conversion (which was a far simpler fix).
> > 
> > I think what is happening in e_trie_search() is that prev is getting set
> > to an invalid UTF-8 char in one pass of the while-loop and then the next
> > pass finds a '@' and sets pat = prev; and then returns pat, which of
> > course is invalid.
> > 
> > or something like that... I thought I had it figured out but now looking
> > at it I'm confused again so I dunno :)
> > 
> > text/plain attachment (63377.patch)
> > Index: ChangeLog
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
> > retrieving revision 1.3438
> > diff -u -r1.3438 ChangeLog
> > --- ChangeLog	24 Aug 2004 02:54:03 -0000	1.3438
> > +++ ChangeLog	25 Aug 2004 20:55:59 -0000
> > @@ -1,3 +1,26 @@
> > +2004-08-25  Jeffrey Stedfast  <fejj novell com>
> > +
> > +	Fix for bug #63377
> > +
> > +	* em-format.c (em_format_format_text): Make sure that 'charset' is
> > +	never NULL, if it's NULL, then use 'iso-8859-1' this way we will
> > +	never pass invalid UTF-8 to the tohtml filter.
> > +	(emf_init): Init emf->default_charset to use the mailer charset
> > +	setting (up until now, nothing actually used that in mailer!?!?)
> > +	(emf_finalise): Free the default_charset string (would have leaked
> > +	if it were ever actually used before).
> > +
> > +2004-08-24  Jeffrey Stedfast  <fejj novell com>
> > +
> > +	Fix for bug #63177
> > +
> > +	* em-folder-tree.c (emft_drop_async_drop): Check full_name == NULL
> > +	rather than full_name[0] since store's have NULL full_names, not
> > +	empty string (like they used to).
> > +	(emft_drop_folder): Same.
> > +	(tree_drag_data_received): Don't abort the drop if the user
> > +	dropped on a store, this is allowed (depending on the store).
> > +
> >  2004-08-23  Not Zed  <NotZed Ximian com>
> >  
> >  	* em-folder-tree.c (em_folder_tree_set_selected): store the
> > Index: em-format.c
> > ===================================================================
> > RCS file: /cvs/gnome/evolution/mail/em-format.c,v
> > retrieving revision 1.38
> > diff -u -r1.38 em-format.c
> > --- em-format.c	10 Jul 2004 01:31:04 -0000	1.38
> > +++ em-format.c	25 Aug 2004 20:55:59 -0000
> > @@ -32,6 +32,8 @@
> >  #include <libgnomevfs/gnome-vfs-mime-utils.h>
> >  #include <libgnomevfs/gnome-vfs-mime-handlers.h>
> >  
> > +#include <gconf/gconf-client.h>
> > +
> >  #include <e-util/e-msgport.h>
> >  #include <camel/camel-url.h>
> >  #include <camel/camel-stream.h>
> > @@ -116,11 +118,16 @@
> >  emf_init(GObject *o)
> >  {
> >  	EMFormat *emf = (EMFormat *)o;
> > +	GConfClient *gconf;
> >  	
> >  	emf->inline_table = g_hash_table_new(g_str_hash, g_str_equal);
> >  	e_dlist_init(&emf->header_list);
> >  	em_format_default_headers(emf);
> >  	emf->part_id = g_string_new("");
> > +	
> > +	gconf = gconf_client_get_default ();
> > +	emf->default_charset = gconf_client_get_string (gconf, "/apps/evolution/mail/display/charset", NULL);
> > +	g_object_unref (gconf);
> >  }
> >  
> >  static void
> > @@ -136,6 +143,7 @@
> >  
> >  	em_format_clear_headers(emf);
> >  	camel_cipher_validity_free(emf->valid);
> > +	g_free (emf->default_charset);
> >  	g_free(emf->charset);
> >  	g_string_free(emf->part_id, TRUE);
> >  
> > @@ -1016,7 +1024,8 @@
> >  		
> >  		charset = camel_mime_filter_windows_real_charset (windows);
> >  	} else if (charset == NULL) {
> > -		charset = emf->default_charset;
> > +		if (!(charset = emf->default_charset))
> > +			charset = "iso-8859-1";
> >  	}
> >  	
> >  	filter_stream = camel_stream_filter_new_with_stream(stream);
> -- 
> 
> Michael Zucchi <notzed ximian com>
> "born to die, live to work, it's
> all downhill from here"
> Novell's Evolution and Free
> Software Developer
-- 
Jeffrey Stedfast
Evolution Hacker - Novell, Inc.
fejj ximian com  - www.novell.com

Attachment: smime.p7s
Description: S/MIME cryptographic signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]