xdg-mime will throw an error without qt5-tools installed

Description:

When calling xdg-mime, you get an error if qt5-tools is not installed:
/usr/bin/xdg-mime: line 885: qtpaths: command not found

Additional info:

Issue caused by xdg-mime calling qtpaths from $PATH but with Qt6-only installation there will be no qtpaths in $PATH.
qt5-tools contains /usr/bin/{qtpaths,qtpaths-qt5} while qt6-base only has /usr/lib/qt6/bin/{qtpaths,qtpaths6} which makes them inaccessible for xdg-mime.

Couple things to note:

  • Debian makes qtpaths6 accessible from /usr/bin/qtpaths6 (but it xdg-mime will not use it anyway)
  • qtpaths is available from qtchooser which is version-agnostic

Given all of the above I don't know whose issue it is: xdg-mime, qt6 or the way arch packages qt versions. But since the issue itself comes from xdg-mime it's filed here.

Important thing is that it can't be "solved" by making qt5-tools as xdg-utils optional dependency. Since KDE provided by Arch is based on Qt6 you don't need Qt5 and qt5-tools. Also qt6 already contains qtpaths, just not where you can access it.

Steps to reproduce:

  1. $ xdg-mime default ...
Edited by Maxim