<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-settings assumes desktop files have exactly one Exec line"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=92170">92170</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>xdg-settings assumes desktop files have exactly one Exec line
          </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>Linux (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>chad.miller@canonical.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Example command:

xdg-settings set default-web-browser chromium-browser.desktop


In searching the desktop file for suitability, it scans for all lines that
begin "Exec", and takes the result and packs it into a variable.

If there is exactly one Exec line, this takes out a command name to test for
existence, but when more than one matches, the program name is captured as
"firstexecprog\nsecondexecprog\nthirdexecprog", and "which" doesn't know how to
look up a program like that and the subsequent tests fail.

Output with sh's "-x" option on:


+ grep -E ^Exec(\[[^]=]*])?= /usr/share//applications/chromium-browser.desktop
+ command=chromium-browser
chromium-browser
chromium-browser
chromium-browser
+ which chromium-browser
chromium-browser
chromium-browser
chromium-browser
+ command=
+ readlink -f
+ return
+ binary=
+ [  ]
+ exit_failure_file_missing
+ [ 0 -gt 0 ]


In desktop_file_to_binary and binary_to_desktop_file functions, it makes false
assumptions how many times grep may match. Those should treat each Exec match
separately.</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>