Endless recursion in xdg-open due to incorrect handling of spaces in directory names
Submitted by Sophie Hirn
Assigned to Portland Bugs
Link to original bug (#109205)
Description
xdg-open can be brought to recurse endlessly into a crash with the following setup:
-
Inside the search path for .desktop files, place a directory with name (e.g.)
Grinding Gear Games
-
Create a directory named
Games
in your home directory. -
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
.