I debugged xdg-mime and found the error is generated in the line 1005 in function defapp_kde()
trader_result=`$KTRADER $MIMETYPE "$MIME" $SERVICETYPE Application 2>/dev/null \ | grep DesktopEntryPath | head -n 1 | cut -d ':' -f 2 | cut -d \' -f 2` trader_result gets value empty string because grep DesktopEntryPath returns empty string, i have no idea what it is supposed to be either The actual output of $KTRADER $MIMETYPE "$MIME" $SERVICETYPE Application 2>/dev/null is: mimetype is : text/html servicetype is : Application got 9 offers. /usr/share/applications/google-chrome.desktop /usr/share/applications/firefox.desktop /usr/share/applications/rstudio.desktop /usr/share/applications/org.kde.kate.desktop /usr/share/applications/libreoffice-writer.desktop /usr/share/applications/kde4/okularApplication_txt.desktop /usr/share/applications/emacs24.desktop /usr/share/applications/vim.desktop /usr/share/applications/emacs24-term.desktop Which means grep DesktopEntryPath doesn't do anything and it is not an environment variable either it is not being set anywhere in the xdg-mime script. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1620772 Title: xdg-settings and xdg-mime query fail with status 4 in kde 5 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1620772/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs