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 487415 - Songs that have a space in their path are not imported automatically from watched music folders
Songs that have a space in their path are not imported automatically from wat...
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: Importing
0.11.x
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 514158 534330 543887 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-10-17 08:15 UTC by Sebastien Bacher
Modified: 2008-07-20 22:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rb-disable-local-uri-escaping.patch (975 bytes, patch)
2007-10-18 09:09 UTC, Bastien Nocera
none Details | Review
rb-disable-local-uri-escaping-2.patch (2.08 KB, patch)
2007-10-22 11:16 UTC, Bastien Nocera
none Details | Review
rb-disable-local-uri-escaping-3.patch (3.02 KB, patch)
2007-10-22 15:48 UTC, Bastien Nocera
needs-work Details | Review
rb-disable-local-uri-escaping-4.patch (5.03 KB, patch)
2007-10-25 14:10 UTC, Bastien Nocera
none Details | Review
change from Alexander Gitter attached to the ubuntu bug (711 bytes, patch)
2008-05-13 11:54 UTC, Sebastien Bacher
needs-work Details | Review
use g_filename_to_uri rather (636 bytes, patch)
2008-05-13 13:06 UTC, Sebastien Bacher
committed Details | Review

Description Sebastien Bacher 2007-10-17 08:15:57 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)
"
Comment 1 Bastien Nocera 2007-10-17 11:46:01 UTC
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.
Comment 2 Bastien Nocera 2007-10-17 19:36:54 UTC
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?
Comment 3 Bastien Nocera 2007-10-18 09:09:50 UTC
Created attachment 97407 [details] [review]
rb-disable-local-uri-escaping.patch
Comment 4 Bastien Nocera 2007-10-18 09:26:17 UTC
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...)
Comment 5 Bastien Nocera 2007-10-22 11:16:50 UTC
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.
Comment 6 Bastien Nocera 2007-10-22 15:48:00 UTC
Created attachment 97639 [details] [review]
rb-disable-local-uri-escaping-3.patch

Also up the DB version so the URIs get recanonicalised.
Comment 7 Bastien Nocera 2007-10-25 13:52:41 UTC
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.
Comment 8 Bastien Nocera 2007-10-25 14:10:17 UTC
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.
Comment 9 Jonathan Matthew 2007-10-28 06:40:57 UTC
Looks OK and seems to work properly for me.
Comment 10 Bastien Nocera 2007-10-28 12:25:57 UTC
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.
Comment 11 Bastien Nocera 2008-02-05 18:47:56 UTC
*** Bug 514158 has been marked as a duplicate of this bug. ***
Comment 12 Ralf.Nieuwenhuijsen 2008-04-04 22:30:41 UTC
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)
Comment 13 Sebastien Bacher 2008-04-21 09:21:16 UTC
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"
Comment 14 Jonathan Matthew 2008-04-22 12:50:56 UTC
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.
Comment 15 Sebastien Bacher 2008-05-13 11:54:38 UTC
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
Comment 16 Sebastien Bacher 2008-05-13 11:55:40 UTC
the change looks good to me, maybe using g_filename_to_uri would be nicer though
Comment 17 Bastien Nocera 2008-05-13 12:18:29 UTC
(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.
Comment 18 Sebastien Bacher 2008-05-13 13:06:48 UTC
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
Comment 19 Jonathan Matthew 2008-05-22 22:25:58 UTC
*** Bug 534330 has been marked as a duplicate of this bug. ***
Comment 20 Jonathan Matthew 2008-05-30 00:12:26 UTC
committed to svn.
Comment 21 Jonathan Matthew 2008-07-20 22:31:44 UTC
*** Bug 543887 has been marked as a duplicate of this bug. ***