conversion freezes when output folder name contains a '#' character

Bug #1594698 reported by Thomas Zauner on 2016-06-21
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
SoundConverter
Critical
GautierPortet

Bug Description

The conversion (yet tested for mp3->mp3 and mp3->ogg) freezes at 'preparing conversion' when output folder name contains a '#' character.
Works fine when used with different output folder.

Richard Haynes (richhaynes) wrote :

I have this exact same issue. The simplest workaround is to remove all # characters from folders / filenames but it took alot of trial and error before I realised this was the cause.

The issue arises from gnomevfs reporting that the filename is a directory and refusing to proceed. This causes the UI to hang on 'Preparing conversion' but the error can be read from the command line:

SoundConverter 2.1.3
  using Gstreamer version: 0.10.36
  using 4 thread(s)
  using gio
  "faac" gstreamer element not found, disabling AAC output.
Queue start: 1 tasks, 4 thread(s).
Queue done in 0.019s (1 tasks)
Traceback (most recent call last):
  File "/usr/lib/soundconverter/python/soundconverter/ui.py", line 1369, in on_convert_button_clicked
    self.do_convert()
  File "/usr/lib/soundconverter/python/soundconverter/ui.py", line 1351, in do_convert
    self.converter.add(sound_file)
  File "/usr/lib/soundconverter/python/soundconverter/gstreamer.py", line 695, in add
    vfs_unlink(output_filename)
  File "/usr/lib/soundconverter/python/soundconverter/fileoperations.py", line 101, in vfs_unlink
    gnomevfs.unlink(gnomevfs.URI(filename))
gnomevfs.IsDirectoryError: Is a directory

File formats make no difference to this error. It is caused soley by having a hash ANYWHERE in the path or filename. This has been confirmed with repeated tests.

I know nothing about gnomevfs and nor do I want to! But what I did discover was that the # character has a special meaning in gnomevfs.URI and this causes the filename to become a path only i.e.

gnomevfs.unlink(gnomevfs.URI('/home/pi/Music/#album123/abc.mp3'))

...becomes...

gnomevfs.unlink('/home/pi/Music/'))

...which results in the IsDirectoryError.

I found this information here:

https://developer.gnome.org/gnome-vfs/stable/gnome-vfs-2.0-gnome-vfs-uri.html#GNOME-VFS-URI-MAGIC-CHR:CAPS

Which states:

#define GNOME_VFS_URI_MAGIC_CHR '#'
The character used to divide location from extra "arguments" passed to the method.

From my above example, gnomevfs.URI('/home/pi/Music/#album123/abc.mp3') would split the path into an actual path of /home/pi/Music/ with argunments of album123/abc.mp3 which when passed to gnomevfs.unlink causes said error.

The only options I can think of would be to catch the error, stop preparation and warn the user to remove # from folder or filenames or to set GNOME_VFS_URI_MAGIC_CHR to something nobody will use (although im sure the new value would catch someone else out along the line).

I hope this information is helpful. I would consider patching this myself but I am new to Python and know nothing about gnomevfs so I wouldn't want to do something that may stop it working altogether.

Let me know if you need more information.

GautierPortet (kassoulet) wrote :

THe fix was already done for newer versions: https://bugs.launchpad.net/soundconverter/+bug/1524487

Thank you very much for your help.

GautierPortet (kassoulet) wrote :

My bad, this is another issue with quote/unquote.

The folder is stored unquoted in settings, and is quoted twice when used.

Fix: https://github.com/kassoulet/soundconverter/commit/3a17d980bee5e87de6e6d8675076960600d8e297

Changed in soundconverter:
importance: Undecided → Critical
assignee: nobody → GautierPortet (kassoulet)
milestone: none → 3.0.0-beta2
status: New → Fix Committed
Changed in soundconverter:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers