[Bug 673319] New: Need to use \\\\ for filenames containing '\' when using gst-launch

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Sun Apr 1 13:28:41 PDT 2012


https://bugzilla.gnome.org/show_bug.cgi?id=673319
  GStreamer | gstreamer (core) | unspecified

           Summary: Need to use \\\\ for filenames containing '\' when
                    using gst-launch
    Classification: Platform
           Product: GStreamer
           Version: unspecified
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gstreamer (core)
        AssignedTo: gstreamer-bugs at lists.freedesktop.org
        ReportedBy: teuf at gnome.org
         QAContact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---


I've been trying to run
gst-launch filesrc location="/home/teuf/Musique/Röyksopp - Melody A.M./10.
Röyksopp - 40 Years Back\\Come.flac" !            decodebin name=decode !
audio/x-raw-int !            appsink name=sink sync=False emit-signals=True

(note the \\ in the filename). The file I'm trying to handle is '40 Years
Back\Come.flac', the \\ in the command line is for shell escaping.
echo "40 Years Back\\Come.flac" gives me the expected '40 Years Back\Come.flac'

However, this does not work with GStreamer, it wants the \ to be escaped in the
filename it gets, otherwise it will fail with "could not find 40 Years
BackCome.flac"

This comes from the fact that gst_parse_unescape in gst/parse/types.h turns
'\x' into 'x' whatever x is, so with a single '\', '\C' will be turned into
'C'. With '\\', it's turned into '\' as expected.

gst/gstparse.c has a _gst_parse_escape function which escapes \" as needed, but
it doesn't do anything for '\'. This patch would handle escaping there and
fixes the issues I'm seeing:

diff --git a/gst/gstparse.c b/gst/gstparse.c
index a2d3d3d..05d696e 100644
--- a/gst/gstparse.c
+++ b/gst/gstparse.c
@@ -197,7 +197,7 @@ _gst_parse_escape (const gchar * str)
   gstr = g_string_sized_new (strlen (str));

   while (*str) {
-    if (*str == ' ')
+    if ((*str == ' ') || (*str == '\\'))
       g_string_append_c (gstr, '\\');
     g_string_append_c (gstr, *str);
     str++;

However, changing this behaviour might be undesirable (for example
http://sourceforge.net/projects/gsvideo/files/gsvideo/1.0/ says "Single
backslashes are replaced by double backslashes to avoid path problems in
gstreamer"), or this behaviour might even be on purpose, so let me know if I
should make a proper git-formatted patch, or if this bug should be closed :)

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list