-
Notifications
You must be signed in to change notification settings - Fork 39
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
OpenURI: open file with write access when requested #26
Conversation
The check for write access in xdg-desktop-portal is here. |
Should that check also be reversed? If you can check that that's the case, then I'm happy with this change. |
That check is correct in my opinion. It checks whether we specified the file should be writable (you can request that with a flag in libportal) and whether the passed file descriptor is writable. If we specify it is writable, but we don't open the file with write access, then it obviously fails the check and you are not allowed to open the file. |
I meant we should have both checks, not that this one was incorrect eg:
|
I misunderstood before what you meant. We should have both: |
I'd like xdg-desktop-portal to throw a warning for the current libportal code. Then the patch in this MR becomes obviously correct. |
I will try to write a test case for xdg-desktop-portal. I had planned this anyway. |
I discussed this with @matthiasclasen yesterday, the test case for this requires a sandbox environment and we don't do the tests this way in xdg-desktop-portal yet and I don't want to spend that much time on it since it shouldn't be mandatory for this fix, because it's clear and obvious. Can we merge it then? |
I didn't ask for a test case to be written, I said:
So, one commit to add the warning. One commit that fixes that warning with some details like a backtrace, or at least the error message. |
Also reject non-writable requests that come with writable file descriptors. See flatpak/libportal#26
Can you try reproducing the issue with this patch and running xdg-desktop-portal with It should print a warning about |
The error message is:
|
Also reject non-writable requests that come with writable file descriptors. See flatpak/libportal#26
I already had an error message there as I put it there myself when I was debugging this issue, based on that I wrote this patch. Anyway, I built xdg-desktop-portal from your branch, dropped this patch from my local Dolphin build and I got your error message: |
Can you update the commit message to include the error message as we discussed, so we can merge this? |
When user specifies to open a file with write access, we need to open it with specified permission, otherwise xdg-desktop-portal will fail as it checks for write access. Also follow glib and do not use O_PATH, because since xdg-desktop-portal 1.0.1, regular file descriptors are also accepted. Not opening the file with write access results into following error in xdg-desktop-portal: ** (/usr/libexec/xdg-desktop-portal:55877): DEBUG: 21:32:54.753: Rejecting open request for xxx as opening writable but fd is not writable
99a9466
to
e8069f6
Compare
Done. |
When user specifies to open a file with write access, we need to open it with specified permission, otherwise xdg-desktop-portal will fail as it checks for write access.
Also follow glib and do not use O_PATH, because since xdg-desktop-portal 1.0.1, regular file descriptors are also accepted.
For reference: