On Mon, Jun 03, 2024 at 01:43:54PM +0200, Charles Plessy wrote: > I just tried using dpkg-query to find with package the desktop file > belongs to. However, this is way too slow for a script that may be run > multiple times when packages are installed or removed. > > At the moment I do not see another solution than documenting the issue > better in the manual page of update-mime. > > Do you have a better suggestion?
In the short term, no. In the longer run, though, I'd propose to make debhelper generate files in /usr/lib/mime/packages/ for any packages that install .desktop files in /usr/share/applications/, and then change update-mime to no longer parse the .desktop files itself (unless explicitly told to by a command-line option, perhaps). This may require some adjustments to Debian policy. I haven't researched the development history of update-mime, but the parsing of the .desktop files feels like it was added as an afterthought and doesn't fit in very well; I would either drop it or redesign the whole thing.