Re: Gnome 2.10 Showstoppers - Update

On Thu, 2005-02-17 at 09:28 -0500, Vincent Noel wrote:

> #146130 (background) : incorrect UTF-8 filename => empty filename tag -> crash
>     Crash in the background capplet due to an incorrect UTF-8 filename. An
>     example of an entry in .gnome2/backgrounds.xml that causes a crash is
>     included. No solution in sight, no patch. Large number of duplicates.
> #146645 (background) : gnome-background-properties crashes
>     Files with non-UTF-8 filenames make the background capplet crash. A patch
>     was proposed but rejected. No solution proposed. Large number of
>     duplicates.

These just require some careful code-combing.  It's a classic bug of
using filename encodings wrongly.

1. I see this in gnome_wp_item_new():

   item->filename = gnome_vfs_unescape_string_for_display (filename);

   [where "filename" ultimately comes from gtk_file_chooser_get_filenames(), 
   which returns filenames in the Glib filename encoding: ]

Subsequently, that item->filename is used in a bunch of places,

   xmlNewTextChild (wallpaper, NULL, "filename", wpitem->filename);

2. What encoding is used to store the filenames in backgrounds.xml?  Are
they filenames or URIs?  If you want filenames, you should encode them
into something representable by the XML.  Encoding them as URIs is
simpler; just use g_filename_to_uri() --- this generates a URI which is
obviously ASCII.

3. The code needs to handle filenames which have non-UTF on-disk
representations.  See about this.  It's trivial to convert these to URIs, and they are always representable; just use g_filename_to_uri().  It's easy to get displayable (UTF-8) strings out of them; just use g_filename_display_name() or g_filename_display_basename().

4. The code needs to handle invalid backgrounds.xml files which have
filenames with broken encoding.  Just test them for validity when you
read them out of that file, convert them to something sane, and write
back a valid file.  "Valid" here implies deciding upon (1) and (2)


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