[Portland-bugs] [Bug 101039] New: xdg-mime does not handle whitespace in .desktop file names correctly

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sun May 14 19:33:05 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=101039

            Bug ID: 101039
           Summary: xdg-mime does not handle whitespace in .desktop file
                    names correctly
           Product: Portland
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: xdg-utils
          Assignee: portland-bugs at lists.freedesktop.org
          Reporter: freedesktop at thecybershadow.net

On my system, running:

$ xdg-open http://google.com

Prints this to stderr:

/usr/sbin/xdg-mime: line 323: [: too many arguments
/usr/sbin/xdg-mime: line 325: [: too many arguments

xdg-mime at line 323 looks like this:

            if [ -r $dir/applications/$vendor/$app ]; then
                file_path=$dir/applications/$vendor/$app
            elif [ -r $dir/applnk/$vendor/$app ]; then
                file_path=$dir/applnk/$vendor/$app
            fi

It looks like xdg-mime does not properly quote variables before expansion,
which makes them subject to globbing and word splitting.

The particular file that causes xdg-mime to misbehave is:

/home/vladimir/.local/share/applications/userapp-Firefox Developer
Edition-ZN8AEY.desktop

I'm not sure what created it, but it does have spaces in the file name.

Regardless of whether spaces are allowed in such file names, not quoting
variables that are not intended to be expanded is a bug.

I strongly recommend linting shell scripts with ShellCheck
(http://www.shellcheck.net/) to prevent bugs like this one.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/portland-bugs/attachments/20170514/2843844b/attachment.html>


More information about the Portland-bugs mailing list