GNOME Bugzilla – Bug 168604
[Patch] Background Properties does not support non-UTF-8 filenames
Last modified: 2007-08-13 14:38:17 UTC
Please describe the problem: Filenames which are not encoded in the UTF-8 character set are not handled appropriately in the gnome background settings. There were a number of duplicates to a couple crashers which I am resolving as duplicates of this bug now. The code which is about to be committed to CVS (as soon as this bug is filed for reference) no longer crashes. It will simply ignore non-UTF-8 encoded filenames for the time being. This is a quick fix to solve the crashing problem. Ignoring the files, is much better than crashing or corrupting the XML and aborting on next run. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
*** Bug 146645 has been marked as a duplicate of this bug. ***
*** Bug 146130 has been marked as a duplicate of this bug. ***
*** Bug 171589 has been marked as a duplicate of this bug. ***
It should be converted from current locale into UTF-8 (man iconv). The current "fix" fixes nothing. In fact, it breaks background setting and can be a showstopper for photo-amateurs.
The fix fixes the crash. It doesn't break anything. You can't break something that never worked in the first place. If you convert the filenames into UTF-8 on the filesystem, then it will work fine. I will look at the problem further when I have the time to do so. The patch that was proposed in one of the other bugs, does not fix the problem, and causes other crashes. Due to time constraints, and the number of crash occurances, I was forced to fix the crash by just ignoring invalid UTF-8 filenames.
My family hopes that it happens before next release :)
How can I manually remove saved background setting information? After I added png of non-utf-8 filename to background, I can't use gnome-background-properties because it always crashes.
*** Bug 301400 has been marked as a duplicate of this bug. ***
*** Bug 172235 has been marked as a duplicate of this bug. ***
Created attachment 45718 [details] Againt cvs HEAD. Gzipped tarball. Patch background capplet of gnome-control-center, and nautilus. Known problem; you can add an item many times. FIXME.
These patches also have several memory leaks in them.
Bug 146130 has a large number of duplicates....
*** Bug 304987 has been marked as a duplicate of this bug. ***
Created attachment 46759 [details] [review] patches for gnome-wp-capplet.c, gnome-wp-item.c and gnome-wp-xml.c Revised patch 45718. I fixed memory reak and some minor problems. Could somebody change the patch for HEAD? I don't have the HEAD environment.
I also filed bug 172240 for nautilus.
Created attachment 46760 [details] [review] Obsolete 46759.
*** Bug 308895 has been marked as a duplicate of this bug. ***
Takao: Can you at least make the patch against 2.10 or something? 2.6 is ridiculously old.
*** Bug 311851 has been marked as a duplicate of this bug. ***
*** Bug 312982 has been marked as a duplicate of this bug. ***
*** Bug 314078 has been marked as a duplicate of this bug. ***
Created attachment 51402 [details] [review] Patch for gnome-wp-capplet.c, gnome-wp-item.c, gnome-wp-xml.c and preferences.c Created the patch for GNOME 2.11.
I'm sorry for the late response. Now I got time to setup GNOME 2.11. I checked the patch on Linux only and probably I'll need a test for Solaris. However at the moment, this patch works fine.
Is this pending? Anybody has a good solution? or I want make this patch commited into cvs repository.
I wasn't aware of an updated patch. I'll review it soon.
Hrmm. It looks like there are unrelated changes in the patch for the background capplet part. The libbackground part still needs some work I think, to support filenames encoded in utf8, when using G_BROKEN_FILENAMES and a non-utf8/ascii locale. I've made those changes, and will test them soon. However, in the capplet-specific code, you seem to have some changes at least in the dragged image callback code that are not related to charset encoding at all. This is just a first glance though, and I haven't seen all of the changes yet, so there may still be more.
What are the following changes for? Why are they here? They have nothing to do with the charset issue. @@ -168,6 +165,7 @@ static void bg_properties_dragged_image uris = gnome_vfs_uri_list_parse ((gchar *) selection_data->data); if (uris != NULL && uris->data != NULL) { + GList * uris_orig = uris; GdkCursor * cursor; cursor = gdk_cursor_new_for_display (gdk_display_get_default (), @@ -176,9 +174,10 @@ static void bg_properties_dragged_image gdk_cursor_unref (cursor); for (; uris != NULL; uris = uris->next) { - realuris = g_slist_append (realuris, - g_strdup (gnome_vfs_uri_get_path (uris->data))); + gchar *filename_uri = gnome_vfs_unescape_string_for_display (gnome_vfs_uri_get_path (uris->data)); + realuris = g_slist_append (realuris, filename_uri); } + uris = uris_orig; gnome_wp_add_images (capplet, realuris); gdk_window_set_cursor (capplet->window->window, NULL); }
Created attachment 52413 [details] [review] Patch to the capplet portion of the background setting code
Created attachment 52414 [details] [review] Patch for libbackground portion of code
These two new patches are what I will commit assuming that they get enough testing. Please test them with various charsets. They seem to work for me in ISO8859-1 and UTF-8. They also allow UTF-8 while in other charsets as well. So please test that both UTF-8 and your charset work while logged in with a non-UTF8 charset and proper environment settings.
*** Bug 172240 has been marked as a duplicate of this bug. ***
*** Bug 317086 has been marked as a duplicate of this bug. ***
I don't mind to use UTF-8 or URI. I checked the latest patch and it's ok. Just reply: > What are the following changes for? Why are they here? They have nothing to do > with the charset issue. > + GList * uris_orig = uris; [...] > + uris = uris_orig; It's not this bug. I noticed the uris is freed later but the uris is incremented in the for() statement so I just reverted uris but it's not so critical.
OK. I've committed my two patches to CVS now. They should be in the 2.12.1 release.
*** Bug 319452 has been marked as a duplicate of this bug. ***
*** Bug 321111 has been marked as a duplicate of this bug. ***
*** Bug 318414 has been marked as a duplicate of this bug. ***
*** Bug 318691 has been marked as a duplicate of this bug. ***
*** Bug 334909 has been marked as a duplicate of this bug. ***
*** Bug 342559 has been marked as a duplicate of this bug. ***
*** Bug 355412 has been marked as a duplicate of this bug. ***
*** Bug 466196 has been marked as a duplicate of this bug. ***