Closed ChrisJAllan closed 2 years ago
Hi, first of all I'm sorry it took so long to answer.
I'm also running Arch and sadly cannot reproduce the issue. Does this happen at startup or when checking the checkboxes for OneClick support?
Closing due to inactivty.
It happens sometimes™ on startup.
After much testing, it turns out xdg-mime
isn't perfectly thread-safe, and can wipe the mimeapps.list file if it's called in parallel. Easy way to show this:
parallel xdg-mime default BeatSaberModManager-url-beatsaver.desktop ::: x-scheme-handler/beatsaver{,,,,,}
though it might still need to be run multiple times, race conditions are annoying like that.
Edit: This has been reported upstream a while ago: https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/171
I have now worked around this by injecting locking into xdg-mime:
#!/bin/bash
flock /tmp/xdg-mime.lock /usr/bin/xdg-mime "$@"
I introduced a lock which should prevent calling xdg-mime in parallel. I've tested this by registering and unregistering a protocol handler in a loop and couldn't detect any faulty behaviour, though do you mind testing it yourself? A build can be found at https://github.com/affederaffe/BeatSaberModManager/actions/runs/2436708259.
Seems fixed, hasn't happened again with the test version (without my other lock, though I think I will leave that on for now, this should really be fixed upstream)
Running Arch Linux.
Log: