Bug 109205 - Endless recursion in xdg-open due to incorrect handling of spaces in directory names
Summary: Endless recursion in xdg-open due to incorrect handling of spaces in director...
Status: NEW
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: Portland Bugs
QA Contact:
Depends on:
Reported: 2019-01-01 15:48 UTC by Sophie Hirn
Modified: 2019-01-01 15:48 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Note You need to log in before you can comment on or make changes to this bug.
Description Sophie Hirn 2019-01-01 15:48:36 UTC
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 https://en.wikipedia.org` 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`.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.