#1006189 /usr/bin/xdg-mime: `xdg-mime query default` blindly greps through .desktop files

Package:
xdg-utils
Source:
xdg-utils
Submitter:
Frédéric Brière
Date:
2026-01-10 11:39:41 UTC
Severity:
normal
#1006189#5
Date:
2022-02-20 21:46:47 UTC
From:
To:
Demonstrating under XFCE (though I think it affects all but KDE):

  $ cat /usr/local/share/applications/foobar.desktop
[Desktop Entry]
# blah blah blah text/unreadable; blah x-scheme-handler/foo; blah blah blah
Name=FooBar
Type=Application
Exec=/bin/true

  $ xdg-mime query default text/unreadable
foobar.desktop
  $ xdg-mime query default x-scheme-handler/foo
foobar.desktop


Basically, search_desktop_file() just blindly greps through every
.desktop file, returning any that matches, regardless of context.  That
is, erm, unexepected, to say the least.  (It at least explains why
commenting out MimeType wasn't showing any effect.)

#1006189#10
Date:
2026-01-10 10:08:08 UTC
From:
To:
Es gibt eine Familienspende in Höhe von 1.850.000,00 USD von Cheng Charlie
Saephan. Bitte antworten Sie für weitere Informationen. Denken Sie daran,
Ihrer Familie und den Bedürftigen in Ihrer Umgebung Gutes zu tun.

Dies ist bereits der zweite Versuch, Sie zu erreichen. Bitte antworten Sie
für weitere Details.