Xdg-open reads the entire file while determining the program to open it
with. This may take a long time if the file is large or on a slow medium.
I use fluxbox and therefore xdg-open uses open_generic_xdg_mime(). The for
loop (L539) is run 3 times and first two iterations do not match either of
the following if clauses. Therefore the original filename ($file) is
passed as an argument to the following greps (L549,L551) and the file is
grepped through several times.
As a quick fix I added an else clause clearing the $file in case the if's
do not match. A more proper fix might be to verify that $file is actually
*.desktop in the latter if clause (L348), but I'll leave that to the pros
:)
for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do
local file
# look for both vendor-app.desktop, vendor/app.desktop
if [ -r "$x/applications/$default" ]; then
file="$x/applications/$default"
elif [ -r "$x/applications/`echo $default | sed -e 's|-|/|'`" ]; then
file="$x/applications/`echo $default | sed -e 's|-|/|'`"
+ else
+ file=""
fi
Dear maintainer, xdg-open is broken, and using it for big files effectively makes xdg-open unusable for generic case (ie. no DE). There is also **security issue** since xdg-open could be manipulated to run any executable if `grep -E "^Exec(\[[^]=]*])?=` match on given file. This is potentionaly very dangerous. Since the bug is generally name collision I suggest renaming the affected variable as quick bugfix. Cheers, Jiri System Information: Debian Release: jessie/sid APT prefers testing APT policy: (990, 'testing'), (500, 'testing-updates'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash xdg-utils depends on no packages. Versions of packages xdg-utils recommends: pn libfile-mimeinfo-perl <none> pn libnet-dbus-perl <none> pn libx11-protocol-perl <none> ii x11-utils 7.7+2 ii x11-xserver-utils 7.7+3+b1 Versions of packages xdg-utils suggests: pn gvfs-bin <none>