Bug 30225

Summary: MPV wrong file association on KDE after install
Product: Mageia Reporter: Michael Slíva <michael>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Normal CC: davidwhodgins, michael
Version: 8   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: mpv-0.32.0-6.1.mga8.src.rpm CVE:
Status comment:

Description Michael Slíva 2022-03-31 17:12:42 CEST
Description of problem: 
After installing the MPV player the KDE file association throws MPV to every single MIME type available. The expected behavior is that the MPV gets its file association only to the MIME types listed in the .desktop file under the "MimeType=" keyword since those are actually supported.

Version-Release number of selected component (if applicable): 0.32.0


How reproducible: every time 


Steps to Reproduce:
1. Install the MPV package using URPMI.
2. Open KDE's "System Settings" and navigate to "Personalization --> Applications --> File Associations".
3. Search for any MIME type or ones that should clearly not be supported by MPV (for example 'application/x-iptrace' or 'application/zip') and you will find that MPV is associated with it.
Michael Slíva 2022-03-31 17:15:04 CEST

CC: (none) => michael

Comment 1 sturmvogel 2022-03-31 17:53:35 CEST
I tried under an up to date 64 bit Plasma. This problem is not reproducible, neither with the normal nor the tainted mpv package.

Ever confirmed: 1 => 0
Status: NEW => UNCONFIRMED

Comment 2 Dave Hodgins 2022-03-31 18:51:05 CEST
I cannot confirm either. I have mpv installed ...
$ rpm -qa --last|grep mpv
mpv-0.32.0-6.1.mga8.x86_64                    2021-07-13T19:05:42 EDT
lib64mpv1-0.32.0-6.1.mga8.x86_64              2021-07-13T19:05:42 EDT

My file associations for zip shows "Files, Ark, and Engrampa".
For application/ogg, it does show mpv Media Player, among the others I have
installed.

I suggest creating a new user and see if this is a system wide problem on that
system, or just a problem with the configuration for that user.

CC: (none) => davidwhodgins

Comment 3 Michael Slíva 2022-03-31 19:05:04 CEST
I logged in as another user and MPV was not listed on unsupported apps. I have no idea how this happened, but it seems like this is a user-wide issue.

Is there any file that keeps persistent associations? Since when I uninstall MPV and install it again the incorrect associations are still there.

Cheers
Comment 4 Dave Hodgins 2022-03-31 19:56:52 CEST
Installing or uninstalling packages never alter files in /home, which may
not even be mounted when installing or uninstalling packages.

The user altered file associations appear to be stored in
~/.config/mimeapps.list

Closing the bug as invalid since it isn't caused by a problem in the Mageia
packages.

Status: UNCONFIRMED => RESOLVED
Resolution: (none) => INVALID

Comment 5 Michael Slíva 2022-03-31 20:48:41 CEST
I check all the files listed here https://wiki.archlinux.org/title/XDG_MIME_Applications#mimeapps.list and I could find mpv.desktop listed only on mimes where it is supposed to be. 

Sorry for reporting this as a bug since this is now clearly only on my end. However, I have no idea how to fix this since looking up "application registered for all mime types" does not yield any good results.

Cheers
Comment 6 Dave Hodgins 2022-03-31 21:49:04 CEST
Install the command tree (if it isn't already installed).
Check the files shown by
$ tree -ifa|grep mime
for the affected user

I ran systemsettings5 under strace and used it to alter the order for zip
file associations. Here's the result ...
$ grep mime strace.txt|grep -v -e 'access(' -e 'statx(' -e 'stat(' -e RDONLY -e '/proc'
173148 openat(AT_FDCWD, "/home/dave/.config/mimeapps.list.lock", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0666) = 26
173148 rename("/home/dave/.config/mimeapps.list.utaJmR", "/home/dave/.config/mimeapps.list") = 0
173148 chmod("/home/dave/.config/mimeapps.list", 0664) = 0
173148 unlink("/home/dave/.config/mimeapps.list.lock") = 0
Comment 7 Dave Hodgins 2022-03-31 21:51:53 CEST
Note that alterations made to the file while that user is logged in and
running kde, made using anything other then systemsettings5 will be overwritten
by kde.

I'd log out as that user, log in as another user, use "su -" to become root,
then delete (or rename) the mimeapps.list for the affected user. That should
remove all user level overrides to the file associations.
Comment 8 Michael Slíva 2022-03-31 22:02:48 CEST
Weird thing is, that in '~/.config.mimeapps.list' I have for example 'application/zip=org.kde.ark.desktop;'. There is no MPV there but when I open 'systemsettings5' and find the 'application/zip' in the file association menu I have 'mpv Media Player' in the Application Preference Order there...

When I ran the same strace on systemsettings5 it uses the same file. It's interesting that MPV is associated with every extension for me. And that to remove the association I have to delete them in the systemsettings5 one by one. Then it adds these lines to the '~/.config/mimeapps.list':

[Removed Associations]
application/vnd.leocad=mpv.desktop;
application/x-java=mpv.desktop;

I will try to log out and delete the file as root as you suggested.
Comment 9 Michael Slíva 2022-03-31 22:40:09 CEST
I was finally able to fix the issue. Unfortunately deleting the file did not help anything but I fixed the problem by running 'sudo update-desktop-database'.

I guess there was some weird glitch in the MIME cache that caused this. Thanks for the help, Dave!

Cheers