<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - xdg-utils fails if user sets a custom IFS environment variable"
href="https://bugs.freedesktop.org/show_bug.cgi?id=81386">81386</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>portland-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>xdg-utils fails if user sets a custom IFS environment variable
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jehan@zemarmot.net
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>xdg-utils
</td>
</tr>
<tr>
<th>Product</th>
<td>Portland
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=102859" name="attach_102859" title="xdg-email: reset the IFS before interpreting a shell command.">attachment 102859</a> <a href="attachment.cgi?id=102859&action=edit" title="xdg-email: reset the IFS before interpreting a shell command.">[details]</a></span>
xdg-email: reset the IFS before interpreting a shell command.
Reproduction:
1/ Set some temporary IFS which is not the default (space). Ex:
$ export IFS=";"
2/ Run the xdg-email command:
$ xdg-email --subject "hello" '<a href="mailto:contact@example.com">contact@example.com</a>'
/home/jehan/.local/bin/xdg-email: 696: /home/jehan/.local/bin/xdg-email: iconv
-t utf8: not found
/home/jehan/.local/bin/xdg-email: 696: /home/jehan/.local/bin/xdg-email: iconv
-t utf8: not found
Result: the command fails. The mailer is run, but all parameters are empty (in
this example for instance, no subject, not recipient pre-filled.
The reason is line 232 of current git master:
str=$(echo "$1" | $utf8)
In this case, utf8="iconv -t utf8", and if IFS is not the default space
character, the shell searches for this string as a whole since it uses the IFS
to separate the commands from the parameters. Hence "not found" error.
Easy to reproduce just on the shell:
$ export IFS=";"
$ a="ls -a"
$ $a
ls -a: command not found
Of course playing with the IFS is not everyday, but that can happen when you
are coding in the shell and needs to loop through some data formatted some
specific way. Better the xdg script be robust against random environments.
Solution is to force back IFS=" " just before. Attached a patch.</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>