GNOME Bugzilla – Bug 550117
Error transferring track with "#" in it
Last modified: 2008-09-10 13:33:53 UTC
I can't transfer files to a removable media if the character # is used in the path. F.ex. a mp3 file with album tag set to "#1 album" can't be transferred. Seems like the path is not fully quoted all the time when a "#" appears (see debug output below). How to reproduce: 1. Try to drag and drop the attached file to a removable media (FAT). Expected result: The file is copied. Actual result: An error dialog is displayed: --- Error transferring track Could not open file "/media/PHONE CARD/music/dummy_artist/#1_album/01 - dummy_track.mp3" for writing. --- Debug output: (22:01:09) [0x95a2410] [impl_paste] rb-removable-media-source.c:343: copying using existing format (22:01:09) [0x95a2410] [impl_build_dest_uri] rb-generic-player-source.c:1088: building dest uri for entry at file:///home/perja/Music/div/test.mp3 (22:01:09) [0x95a2410] [impl_build_dest_uri] rb-generic-player-source.c:1163: dest file is file:///media/PHONE%20CARD/music/dummy_artist/#1_album/01 - dummy_track.mp3 (22:01:09) [0x95a2410] [rb_removable_media_source_build_dest_uri] rb-removable-media-source.c:537: Built dest URI for mime='(null)', extension='mp3': 'file:///media/PHONE%20CARD/music/dummy_artist/#1_album/01 - dummy_track.mp3' (22:01:09) [0x95a2410] [rb_shell_transfer_progress_cb] rb-shell.c:1872: transferred 0 tracks out of 1 (22:01:09) [0x95a2410] [rb_statusbar_sync_status] rb-statusbar.c:474: updating status with: '1 song, 0 minutes, 16.6 KB', '', 999.000000 (22:01:09) [0x95a2410] [error_cb] rb-removable-media-manager.c:660: Error transferring track to file:///media/PHONE%20CARD/music/dummy_artist/#1_album/01 - dummy_track.mp3: Could not open file "/media/PHONE CARD/music/dummy_artist/#1_album/01 - dummy_track.mp3" for writing. (22:01:09) [0x95a2410] [rb_encoder_gst_emit_completed] rb-encoder-gst.c:218: couldn't get size of destination file:///media/PHONE%20CARD/music/dummy_artist/#1_album/01 - dummy_track.mp3: File not found (22:01:09) [0x95a2410] [completed_cb] rb-removable-media-manager.c:682: completed transferring track to file:///media/PHONE%20CARD/music/dummy_artist/#1_album/01 - dummy_track.mp3 (0 bytes) (22:01:09) [0x95a2410] [rb_shell_transfer_progress_cb] rb-shell.c:1872: transferred 1 tracks out of 1 (22:01:09) [0x95a2410] [rb_statusbar_sync_status] rb-statusbar.c:474: updating status with: '1 song, 0 minutes, 16.6 KB', '', 999.000000 (22:01:09) [0x95a2410] [rb_shell_transfer_progress_cb] rb-shell.c:1872: transferred 0 tracks out of 0 (22:01:09) [0x95a2410] [rb_statusbar_sync_status] rb-statusbar.c:474: updating status with: '1 song, 0 minutes, 16.6 KB', '', 999.000000 (22:01:09) [0x95a2410] [bus_watch_cb] rb-encoder-gst.c:240: received error gstfilesink.c(352): gst_file_sink_open_file (): /pipeline/sink: system error: No such file or directory (22:01:09) [0x95a2410] [window_focus_cb] rb-mmkeys-plugin.c:126: window got focus, re-grabbing media keys (22:01:09) [0x95a2410] [rb_statusbar_sync_status] rb-statusbar.c:474: updating status with: '1 song, 0 minutes, 16.6 KB', '', 999.000000 (22:01:10) [0x95a2410] [window_focus_cb] rb-mmkeys-plugin.c:126: window got focus, re-grabbing media keys
Created attachment 117717 [details] Test file with # in the album name.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 374078 ***
I'm reopening this bug as I already have version 0.11.6 with the fix for 374078 included - this bug is still valid there at least. This one might be related to 374078, but it is not the same bug. Did you try to transfer the attached test mp3 to a memory card?
Created attachment 118102 [details] [review] Add # to the list of replaced chars on FAT Can you test whether this patch fixes the issue?
Thanks, I will try it out during the weekend. BTW; from your patch I see that the path is converted into a URI. For URIs the # and a couple of other characters (;&=) have special meaning. F.ex. # is used for fragment ids. Maybe this is causing trouble. Because when I try to "mkdir -p /media/PHONE CARD/music/dummy_artist/#1_album" it works, but somehow RB can't create the same path. I will do some more testing.
The main problem we have here is that rb_uri_get_filesystem_type() doesn't work for files that don't exist yet (I broke it as part of the gio port..), which in turn means that rb_sanitize_uri_for_filesystem() doesn't work.
(In reply to comment #6) > The main problem we have here is that rb_uri_get_filesystem_type() doesn't work > for files that don't exist yet (I broke it as part of the gio port..), which in > turn means that rb_sanitize_uri_for_filesystem() doesn't work. Do you plan to fix it before the next release, or should I reopen bug 374078 ?
Created attachment 118152 [details] [review] Fix rb_uri_get_filesystem_type and add '#' to the escaped chars on FAT Hi, This patch fixes the rb_uri_get_filesystem_type GIO version in case the file doesn't exist, by walking up the file path until getting one that exists. HTH, Colin
It doesn't seem like '#' actually an illegal character on FAT filesystems. The problem is that it needs to be escaped (as %23) in URIs. So, we need to pass every fragment that we use to build up a destination URI through g_escape_uri_string (str, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH_ELEMENT, FALSE) first. I've committed a slightly simpler version of the patch (iterative instead of recursive), since it at least helps. I'll fix the URI building code in rb-library-source.c and rb-generic-player-source.c some time when I'm not falling asleep in my chair.
Created attachment 118213 [details] [review] escape URI components
(In reply to comment #10) > Created an attachment (id=118213) [edit] > escape URI components The last hunk seems wrong: + sane_dest = rb_sanitize_uri_for_filesystem (dest); + g_free (dest); + rb_removable_media_manager_queue_transfer (rm_mgr, entry, dest, NULL, last line should be: rb_removable_media_manager_queue_transfer (rm_mgr, entry, - dest, NULL, + sane_dest, NULL,
*** Bug 440456 has been marked as a duplicate of this bug. ***
Created attachment 118215 [details] [review] this one actually works Thanks for spotting that.
committed.