xdg-mime silently ignores invalid .desktop file

Bug #1926393 reported by Duncan Bayne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
xdg-utils (Ubuntu)
New
Undecided
Unassigned

Bug Description

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)

Revision history for this message
Duncan Bayne (dhgbayne) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.