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...
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-02-16 13:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


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`.
Comment 1 GitLab Migration User 2019-02-16 13:40:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/141.

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.