-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xdg-document-portal: implement flock #1353
base: main
Are you sure you want to change the base?
Conversation
Looks like this will block the entire document portal when any file is blocked due to flock. |
Hi, @swick @hfiguiere Thanks for your suggestion! |
Thanks for the patch. Please squash the suggestion commit into a single commit. |
Supporting flock only for certain option is very suspicious to me. This needs review from someone who knows about fuse and filesystems. |
This is needed for Steam client Signed-off-by: Kyohei KADOTA <[email protected]> Co-authored-by: Hubert Figuière <[email protected]>
Hello, |
You can give the unofficial Steam Flatpak app direct access to locations where you want to add an extra Steam library by completely exiting from Steam, and then using something like:
before starting Steam again and selecting |
Upon using the override I precisely get the original |
No, the override is sufficient by itself. You do need to restart Steam, and you may need to remove and re-add the library in Steam so it doesn't continue to use the portal path. That error means it's probably still going through the document portal. Also, just to be clear, you need to modify the path to match your actual Steam library location; don't use literally |
Really? I'll take a look and try again in a few days (occupied with moving right now). I actually recall that the override was working for me perfectly fine on the Fedora KDE spin, but somehow it has not been working for me on the Fedora Sway spin. Both installations should have me running on Wayland. I appreciate the input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the least worst compromise for the moment.
Do you understand the implications of supporting a weird subset of flags for flock? flock does something on a per-process basis but any flock call on fuse will result in flock being called in the docuement portal process. Do we know what the results are of this? |
I suspect the risk is some app does flock(file) will cause other apps that flock() the same file to not actually receive said lock, meaning the lock is useless. There also seems to be missing "cleanup" of files left locked by some app, meaning an app doing |
The implication is that xdg-document-portal won't support flock() with a particular subset of flags. I also want to ask you to please stop calling things "weird". It doesn't set a productive tone to this conversation.
I do not know. If you do, please inform us. I'll go ahead and merge this, as a stop-gap solution. It'll be interesting to be able to support blocking |
Eh, nevermind, @jadahl raised a good point about app cleanup... |
I guess one could implement file locking on behalf of document portal owners in the document portal, i.e. as long as there is more than one lock owner, we call |
Sorry, but I just don't think it makes a lot of sense to merge things that we don't fully understand even if they seem important to some apps. I'd equally appreciate if you'd stop assuming that everything I say is an attack on you. Calling it weird that just the nonblocking flock variants are supported isn't far fetched because AFAICS when nonblock is supported, so is the blocking variant. What we have here definitely isn't something that apps are used to seeing which can easily introduce issues in some interesting code paths. |
|
@Mikenux I can play games on the external drive with Steam correctly; no overrides. $ ls .local/share/flatpak/
app appstream db exports repo runtime # no overrides directory When I created this PR, I thought "This is not good but Steam works and it does not make document-portal more bad." However, along with I'm reading this thread, I felt it is better to close this PR then to file an issue that is described same problem that this tried to fix. |
I guess if "non-blocking flock operations" means that other apps accessing the file locked by an app can still access and write to it, then that's ok? Only locking read and write access to a file is problematic and should probably be either allowed automatically for known cases or subject to permission. |
I implemented flock operation of FUSE.
This is needed for Steam client.
Tested
I tested whether the new xdg-document-portal accepts flock(2) syscall with flock(1).
Then, within 100 seconds, I ran flock(1) in other terminal session.
I checked blocking operations are rejected.