Bug 354848 - file association loophole: application automatically as default, even if i delete it from the list
Summary: file association loophole: application automatically as default, even if i de...
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (other bugs)
Version First Reported In: 16.12.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-04 18:32 UTC by Wilfrido Vidana
Modified: 2018-05-15 21:56 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wilfrido Vidana 2015-11-04 18:32:51 UTC
Changed pdf file associations so it can be opened with libreoffice. Instead of searching for it on the menu, i directly typed "libreoffice" and it worked. For my surprise, now libreoffice is the default pdf viewer and cannot move it or delete it from the list of "application preference order", after applying changes, it returns to the first place on the list (even when removing it).

Reproducible: Always

Steps to Reproduce:
1. Go to the file associations menu (settings->applications->file associations)
2. On the search bar type pdf and select it
3. Add a new entry to the "application preference order". Type "libreoffice" on the entry, nothing more.
4. Apply changes and open any pdf file (should be openned by libreoffice draw)
5. Now try to move or delete the "libreoffice" entry from the "application preference order" menu. Apply changes.

Actual Results:  
it will magically appear on the first place again...

Expected Results:  
The libreoffice entry to disappear (if deleted) or to be moved down (if moved)

Distribution: Manjaro 15.09 Bellatrix 64-bit
KDE plasma version: 5.4.2
Qt version: 5.5.1
Linux Kernel version: 4.1.12-1-MANJARO (x86_64)
Dolphin version: 15.08.2
Comment 1 Jens 2015-11-08 19:42:52 UTC
There were a couple of reports on #kde of this problem as well, and I was able to reproduce it on my system.
Also happens with applications that are chosen in the menu rather than typed in directly.
Arch system, same versions here. 

Here's a workaround for now:
Edit ~/.local/share/applications/mimeapps.list
to remove any reference to the manually added application.
If you've tried to remove it, it might be under the heading [Deleted Applications] 
for some reason. A .desktop file for the application in question might also have been put in ~/.local/share/applications/ -- it probably doesn't change anything, but removing it is safe.
That done, file associations should be back to normal.

There is also a mimeapps.list in ~/.config/ used by Gnome, if things are still not working, check there.
Comment 2 Wilfrido Vidana 2015-11-08 20:20:37 UTC
Thanks for the workaround! I didn't know where/how to find the files related with this, but with the information you gave me i was able to discover the source of the problem: the file ~/.config/mimeapp.list

Even deleting this file, when i add libreoffice as a pdf reader, it is autogenerated again and the problem is back again. Only deleting this file solves the problem (editing the other mime files does not really take effect on solving the problem).

My guess is that KDE reads from that file when refreshing the fileassociations list, writes in it when adding libreoffice to the list, but does not write in it when deleting references. The problem may be something related with the reading order: if KDE reads the deleted list (in /.local/share/mimeapps.list) and after that it looks into ~/.config/mimeapp.list, this deleted reference gets overriden
Comment 3 pc 2015-11-22 14:35:09 UTC
Thanks for the workaround.

This is reproducible by adding an association for a file in the File Type Editor dialog and then attempt to remove it. After clicking Apply or OK in the File Type Editor it appears to be removed but it isn't.

Only after deleting the file ~/.local/share/applications/mimeapps.list  and restarting Dolphin is the association removed.
Comment 4 pc 2015-11-22 14:37:52 UTC
I forgot to add that this is present in Kubuntu Wily  Dolphin Version 15.08.2
Comment 5 Pavel Mendl 2016-01-06 07:46:53 UTC
Confirming behavior on Linux <censored> 4.3.0-1-amd64 #1 SMP Debian 4.3.3-2 (2015-12-17) x86_64 GNU/Linux (KDE version latest testing = 4:15.08.3-1)

Adding my observation about other (GUI) way to reproduce in hope this helps with bug source insulation:
In Dolphin right click to Properties, here push File Type Options. File type <something>/<something> dialog opens. Now:
1) Using Add button and adding new application has following effects:
a) enlists this application into ~/.local/share/applications/mimeapps.list (making it persisten)
b) adds the association as highest priority (default)
2) Edit button opens dialog showing 0B (zero bytes) length of the file (with reported name <something>.desktop) and does not show/allow to change association parameters. My opinion is that this procedure somehow creates <something>.desktop (in some system location) with no content, while it should be filled with some useful parameters and later mimeaps.list pointing to that file is confused (and  thus does not process removal properly). But it may be million other ways too as ad 2) behavior is true even for previously existing,  properly working associations (?!).

Related as well was my bug 355194, even if strange application I used in the exact case was misleading.  The core of problem is ill-behavior of Dolphin (maybe even KDE core) mime associations functionality. Thanks god for the manual mimeapps.list editing workaround, however some more systematic solution would really suit to KDE.
Comment 6 Florian Sievert 2016-02-07 14:43:41 UTC
Also confirming this on F23 system with latest updates.
Comment 7 Julian Steinmann 2018-04-29 15:12:32 UTC
I can not reproduce this bug with KDE Plasma 5.12.4 & Dolphin 18.04. If I follow the steps from Wilfrido, I can change the LibreOffice entry just like I want to. Can somebody confirm that this issue is fixed now?
Comment 8 Florian Sievert 2018-04-29 17:56:41 UTC
I was also affected by this issue. Seems to work fine for me with Plasma 5.12.44, KDE-Framewokrs 5.44, Qt 5.9.4. Just tried to reproduce the issue, but seems not to be possible anymore.
Comment 9 Julian Steinmann 2018-05-15 16:37:52 UTC
Great, I'll close this report then. Thanks for reporting & commenting @everyone :)
Comment 10 Wilfrido Vidana 2018-05-15 21:56:03 UTC
Hi,

I don't use KDE anymore, but i'm glad to see this got resolved at some point, keep up the good work!

Thanks everyone for the effor :)