Public bug reported: I created an invalid ~/.local/share/applications/mailto.desktop file (note the quotes in Exec):
#!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Name[en_AU]=mailto Exec="mailto %f" Name=mailto I then set the default, and queried it: $ xdg-mime default mailto.desktop 'x-scheme-handler/mailto' $ echo $? 0 $ xdg-mime query default 'x-scheme-handler/mailto' thunderbird.desktop $ echo $? 0 As you can see, no error codes are returned, but the system default application is returned. If I fix the mailto.desktop file by removing the quotes, the query performs as expected: $ xdg-mime query default 'x-scheme-handler/mailto' mailto.desktop Running in verbose mode doesn't give any further information, i.e., that the .desktop file was passed over in search because it was invalid: $ # bad $ XDG_UTILS_DEBUG_LEVEL=9999 xdg-mime query default 'x-scheme-handler/mailto' --verbose Checking /home/duncan/.config/mimeapps.list Checking /home/duncan/.local/share/applications/mimeapps.list Checking /home/duncan/.local/share/applications/defaults.list and /home/duncan/.local/share/applications/mimeinfo.cache Checking /home/duncan/.local/share/applications/defaults.list and /home/duncan/.local/share/applications/mimeinfo.cache Checking /usr/share/stumpwm/applications/defaults.list and /usr/share/stumpwm/applications/mimeinfo.cache Checking /usr/share/stumpwm/applications/defaults.list and /usr/share/stumpwm/applications/mimeinfo.cache Checking /usr/local/share//applications/defaults.list and /usr/local/share//applications/mimeinfo.cache Checking /usr/local/share//applications/defaults.list and /usr/local/share//applications/mimeinfo.cache Checking /usr/share//applications/defaults.list and /usr/share//applications/mimeinfo.cache thunderbird.desktop $ # good $ XDG_UTILS_DEBUG_LEVEL=9999 xdg-mime query default 'x-scheme-handler/mailto' --verbose Checking /home/duncan/.config/mimeapps.list mailto.desktop ProblemType: Bug DistroRelease: Ubuntu 20.10 Package: xdg-utils 1.1.3-2ubuntu1.20.10.2 ProcVersionSignature: Ubuntu 5.8.0-50.56-generic 5.8.18 Uname: Linux 5.8.0-50-generic x86_64 NonfreeKernelModules: nvidia_modeset nvidia ApportVersion: 2.20.11-0ubuntu50.5 Architecture: amd64 CasperMD5CheckResult: skip Date: Wed Apr 28 12:39:08 2021 InstallationDate: Installed on 2020-11-03 (175 days ago) InstallationMedia: Ubuntu 20.10 "Groovy Gorilla" - Release amd64 (20201022) PackageArchitecture: all SourcePackage: xdg-utils UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: xdg-utils (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug groovy -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1926393 Title: xdg-mime silently ignores invalid .desktop file To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1926393/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs