<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - xdg-mime does not handle whitespace in .desktop file names correctly"
href="https://bugs.freedesktop.org/show_bug.cgi?id=101039">101039</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>xdg-mime does not handle whitespace in .desktop file names correctly
</td>
</tr>
<tr>
<th>Product</th>
<td>Portland
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>xdg-utils
</td>
</tr>
<tr>
<th>Assignee</th>
<td>portland-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>freedesktop@thecybershadow.net
</td>
</tr></table>
<p>
<div>
<pre>On my system, running:
$ xdg-open <a href="http://google.com">http://google.com</a>
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
(<a href="http://www.shellcheck.net/">http://www.shellcheck.net/</a>) to prevent bugs like this one.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>