Bug 466591 - File Associations without an asterisk in the regular expression lose associated application.
Summary: File Associations without an asterisk in the regular expression lose associat...
Status: RESOLVED NOT A BUG
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_filetypes (other bugs)
Version First Reported In: 5.27.1
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-28 09:39 UTC by Evert Vorster
Modified: 2023-04-20 12:58 UTC (History)
3 users (show)

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


Attachments
mimeapps.list with the issue (2.97 KB, text/plain)
2023-04-20 12:58 UTC, Evert Vorster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Evert Vorster 2023-02-28 09:39:47 UTC
SUMMARY
***
I am trying to have some custom file associations, but every time the system is restarted, the custom settings are gone.
***


STEPS TO REPRODUCE
1. Create a "Dosbox-x conf" entry under "Applcations > File Associations > Application
2. Set the filename pattern to "dosbox-x.conf"
3. Add Dosbox-x as primary application for these files, and Kate as secondary.
4. Apply
5. Reboot

OBSERVED RESULT
The Applications associated with this entry disappears upon reboot, even though it works properly during the session after they were set.

EXPECTED RESULT
The Applications associated for this file type to be permanent, and survive reboots

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.1
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.2.1-AMD-znver2 (64-bit)
Graphics Platform: X11
Processors: 8 × AMD Ryzen 7 4700U with Radeon Graphics
Memory: 36.9 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: LENOVO
Product Name: 20T8001JUS
System Version: ThinkPad E15 Gen 2

ADDITIONAL INFORMATION
It's neat that you can run dosbox-x just by clicking on it's configuration file. As I am reviewing old MS-DOS games, I have a lot of those files. Check out the channel to see how I use this file association: https://www.youtube.com/channel/UCWdmCsCQiPyVzyjYyehj3xQ
Comment 1 Evert Vorster 2023-03-01 15:51:47 UTC
Funny thing, now these associations have started surviving reboots. 
I'll keep an eye on this, and if it still keeps working for a week or so I'll close the bug. :)
Comment 2 Evert Vorster 2023-03-05 23:07:53 UTC
This problem is now completely gone. 
Since this is a rolling update system, there was probably an update that fixed it, but I would not know which one. 

Thanks, everybody, for looking
Comment 3 Evert Vorster 2023-03-26 11:48:09 UTC
This is happening again, now. 
I posted a quick video of it to Youtube:
https://youtu.be/slNl3TSXJ6s
Comment 4 Evert Vorster 2023-04-14 06:53:45 UTC
This issue is becoming more frequent, and it looks like file associations are forgotten/changed whenever anything updates the file association table. 

I have never seen behavior like this in KDE, and it may very well be down to something I am doing different. 

Normally file associations have an asterisk in the definition, like *.txt so that it would match any file that ends with ".txt"
In my case, there is no asterisk, as I want to match the entire file name exactly. 

In my case, if there is a file called "dosbox-x.conf" in a directory, when I click on that file I want the default action to be to run dosbox-x in the directory where the file is residing, and in the context menu I want to have Kate, so that I can edit this text file. 

When I just add an asterisk in front of "dosbox-x.conf" this strange behavior goes away.
Comment 5 Evert Vorster 2023-04-14 07:36:42 UTC
OK, so I was a bit optimistic there, and my file associations are still disappearing randomly. 

Here is a video clip showing it happening in real time:
https://youtu.be/uI4HLHXOmwc
Comment 6 Nate Graham 2023-04-14 20:34:26 UTC
I can't reproduce the bug exactly the way you have, but there is definitely a major issue here. I can reproduce the issue by adding Dolphin to the apps list of the newly-created doxbox entry; when I click Apply, all apps disappear. This is 100% reproducible for me.
Comment 7 Nate Graham 2023-04-14 20:43:47 UTC
While investigating, I also ran into Bug 468512. Not sure they're related, but it also looks fishy.
Comment 8 Evert Vorster 2023-04-19 19:55:09 UTC
I tracked down my issues to what I suspect was a corrupted mimeapps.list
Anything that would re-create the mime database would trigger these associations to be lost.
Following https://wiki.archlinux.org/title/XDG_MIME_Applications i discovered where the mimetype overrides are kept. 

So I deleted both the current and depreciated copies, then made a new file association.
Once that was completed, I linked the default mimeapps.list to the depreciated location, as suggested on that page. 

Now I can't trigger the issue anymore, I guess after years of messing with file associations it was time to clear them out and start fresh?
I hope this helps someone with the same issues. For now I will close this ticket.
Comment 9 David Faure 2023-04-20 10:46:03 UTC
Good catch. However sending us a copy of the corrupted file would have helped us make the code more robust :-)
Comment 10 Evert Vorster 2023-04-20 12:58:39 UTC
Created attachment 158229 [details]
mimeapps.list with the issue

I honestly don't think it will help much. but just in case, here is the mimeapps.list that was causing the issue.