GNOME Bugzilla – Bug 487415
Songs that have a space in their path are not imported automatically from watched music folders
Last modified: 2008-07-20 22:31:44 UTC
The bug has been opened on https://bugs.launchpad.net/bugs/153502 "... Instead they are shown in the import error section with a file not found error. The spaces in the paths are replaced by %20. Manual importing works without problems. ... Package: rhythmbox 0.11.2-0ubuntu4 ... http://launchpadlibrarian.net/9852131/log rhythmbox -d &>log (7.7 MiB, text/plain) "
We've seen the same problem in Fedora. I believe the problem could be a gnome-vfs bug, although I don't have hard evidence this is the case.
rb_canonicalise_uri() is completely busted: } else if (g_str_has_prefix (uri, "file://")) { /* local file, rhythmdb wants this path escaped */ char *tmp1, *tmp2; tmp1 = gnome_vfs_unescape_string (uri + 7, NULL); /* ignore "file://" */ tmp2 = gnome_vfs_escape_path_string (tmp1); g_free (tmp1); if (tmp2 == NULL) return NULL; tmp2 = escape_extra_gnome_vfs_chars (tmp2); result = g_strconcat ("file://", tmp2, NULL); /* re-add scheme */ g_free (tmp2); Why would you want to escape it *again*, when we were already given a URI?
Created attachment 97407 [details] [review] rb-disable-local-uri-escaping.patch
Jonathan mentioned this bit of code was to fix a few bugs: - Bug 158211 was a bug in totem-plparser (bug #461951) - Bug 329988 already has a good fix (and this bug is more the cause than a solution...)
Created attachment 97599 [details] [review] rb-disable-local-uri-escaping-2.patch Updated patch to handle local relative paths. Make sure we still canonicalise URIs.
Created attachment 97639 [details] [review] rb-disable-local-uri-escaping-3.patch Also up the DB version so the URIs get recanonicalised.
The patch needs to handle upgrades better. We seem to be be skipping important metadata changes when upgrading from 1.0 or 1.1 to the latest version for example.
Created attachment 97845 [details] [review] rb-disable-local-uri-escaping-4.patch Gives us 94 more DB schema upgrades staying in the same major number.
Looks OK and seems to work properly for me.
2007-10-28 Bastien Nocera <hadess@hadess.net> * lib/rb-file-helpers.c: (rb_canonicalise_uri): Use gnome-vfs functions to canonicalise the local file:/// URIs, rather than escaping and unescaping them (Closes: #487415) * rhythmdb/rhythmdb-tree.c: (version_to_int), (rhythmdb_tree_parser_start_element), (rhythmdb_tree_parser_end_element), (save_entry_uint64), (save_entry_double), (save_entry), (rhythmdb_tree_entry_delete), (search_match_properties): Fix the DB upgrade code to handle upgrading from one version to version+2 properly (and not miss necessary upgrades) I changed g_filename_to_uri to gnome_vfs_get_uri_from_local_path, to be sure escaping is the same in all cases.
*** Bug 514158 has been marked as a duplicate of this bug. ***
This bug is _back_ with Ubuntu Hardy (ie. the latest gnome). Suggested workaround: manually setting the music directory in preference again. Which is weird, because this is a clean install. So, i had to manually select the music directory (it completely ignored xdg-user-dirs it seems), then i got this bug. What did not work: - restarting rhythmbox - removing the entries from the library (they just returned automatically) - removing .gnome2/rhythmbox and resettting the music directory once What did work: - setting the music directory twice That must be the weirdest bug ever(tm)
the bug is still there, new ubuntu comment "decided to check out the source code too. the problem is in the file lib/rb-file-helpers.c in the function const char * rb_music_dir (void) { const char *dir; dir = g_get_user_special_dir (G_USER_DIRECTORY_MUSIC); if (dir == NULL) { dir = getenv ("HOME"); if (dir == NULL) { dir = "/tmp"; } } rb_debug ("user music dir: %s", dir); return dir; } it returns dir when it should return basically file://dir. i made the change and it works correctly"
That isn't quite correct. Only the call to rb_music_dir() in rb-library-source.c expects it to return a URI, the others expect a path.
Created attachment 110848 [details] [review] change from Alexander Gitter attached to the ubuntu bug the patch has been attached by Alexander Gitter to the ubuntu bug
the change looks good to me, maybe using g_filename_to_uri would be nicer though
(In reply to comment #16) > the change looks good to me, maybe using g_filename_to_uri would be nicer > though I don't see how it could create a correct URI if the music directory has a space in the name. Use g_filename_to_uri indeed.
Created attachment 110851 [details] [review] use g_filename_to_uri rather right I didn't want to drop the contribution from the guy who did the work investigating the issue that's why I attached his version and suggested using g_filename_to_uri, new patch version using it now
*** Bug 534330 has been marked as a duplicate of this bug. ***
committed to svn.
*** Bug 543887 has been marked as a duplicate of this bug. ***