<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 - Endless recursion in xdg-open due to incorrect handling of spaces in directory names"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=109205">109205</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Endless recursion in xdg-open due to incorrect handling of spaces in directory names
          </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>sophie.hirn@wyvernscale.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>xdg-open can be brought to recurse endlessly into a crash with the following
setup:

1. Inside the search path for .desktop files, place a directory with name
(e.g.) `Grinding Gear Games`

2. Create a directory named `Games` in your home directory.

3. Create a subdirectory named `Grinding Gear Games` somewhere inside the
`~/Games` directory.

Now, running e.g. `xdg-open <a href="https://en.wikipedia.org">https://en.wikipedia.org</a>` from your home directory
will result in an endless recursion and inevitable crash.

I've already found the offending line, it's `scripts/xdg-open.in:330`, which
reads `for d in $dir/*/; do`.

The spaces in the directory name mentioned above lead the search into `~/Games`
due to improper space handling, and the directory `~/Games/<...>/Grinding Gear
Games` makes the search go back to `~/Games` again.

However, I haven't found a POSIX-compliant way of fixing the problem without
restructuring the entire function yet, all my attempts relied either on
bash-specific behaviour or GNU extensions to `find`.</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>