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 550117 - Error transferring track with "#" in it
Error transferring track with "#" in it
Status: RESOLVED FIXED
Product: rhythmbox
Classification: Other
Component: Removable Media
0.11.x
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 440456 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-08-31 20:03 UTC by Per Thomas Jahr
Modified: 2008-09-10 13:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test file with # in the album name. (16.58 KB, audio/mpeg)
2008-08-31 20:04 UTC, Per Thomas Jahr
  Details
Add # to the list of replaced chars on FAT (442 bytes, patch)
2008-09-05 12:35 UTC, Colin Leroy
none Details | Review
Fix rb_uri_get_filesystem_type and add '#' to the escaped chars on FAT (1.42 KB, patch)
2008-09-06 09:11 UTC, Colin Leroy
committed Details | Review
escape URI components (3.23 KB, patch)
2008-09-07 11:59 UTC, Jonathan Matthew
none Details | Review
this one actually works (3.32 KB, patch)
2008-09-07 12:43 UTC, Jonathan Matthew
committed Details | Review

Description Per Thomas Jahr 2008-08-31 20:03:41 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
Comment 1 Per Thomas Jahr 2008-08-31 20:04:29 UTC
Created attachment 117717 [details]
Test file with # in the album name.
Comment 2 Jonathan Matthew 2008-09-05 06:07:50 UTC
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 ***
Comment 3 Per Thomas Jahr 2008-09-05 07:07:25 UTC
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?

Comment 4 Colin Leroy 2008-09-05 12:35:44 UTC
Created attachment 118102 [details] [review]
Add # to the list of replaced chars on FAT

Can you test whether this patch fixes the issue?
Comment 5 Per Thomas Jahr 2008-09-05 12:53:03 UTC
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.
Comment 6 Jonathan Matthew 2008-09-06 02:49:16 UTC
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.
Comment 7 Colin Leroy 2008-09-06 08:41:07 UTC
(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 ? 
Comment 8 Colin Leroy 2008-09-06 09:11:44 UTC
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
Comment 9 Jonathan Matthew 2008-09-06 13:05:50 UTC
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.
Comment 10 Jonathan Matthew 2008-09-07 11:59:46 UTC
Created attachment 118213 [details] [review]
escape URI components
Comment 11 Colin Leroy 2008-09-07 12:05:55 UTC
(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,
Comment 12 Jonathan Matthew 2008-09-07 12:11:35 UTC
*** Bug 440456 has been marked as a duplicate of this bug. ***
Comment 13 Jonathan Matthew 2008-09-07 12:43:03 UTC
Created attachment 118215 [details] [review]
this one actually works

Thanks for spotting that.
Comment 14 Jonathan Matthew 2008-09-10 13:33:53 UTC
committed.